Python简单if语句使用

2024-10-13 06:08:40

1、打开桌面的pycharm程序;

Python简单if语句使用

3、依次点击 New > Python File新建一个python文件;

Python简单if语句使用

5、如图示输入如下代码:#coding:utf-8设置字符编码cars = ['jac','qirui',&#泌驾台佐39;audi','bmw']for car in cars: if car == 'bmw': print(car.upper()) else: print(car.title())

Python简单if语句使用

7、点击运行程序 Run “if”,可以看到程序运行成功。

Python简单if语句使用
猜你喜欢