python 第三天
2017-10-13 22:21
113 查看
今天只看了第五章if语句,剩余的时间看看斯科特杨的如何高效学习,总感觉自己的学习效率有点低,还有自己的专注也非常差,希望可以找到好的方法改善一下!这本书我非传上来供大家阅读!
今天就传两段小代码吧!
#if条件语句的学习和用法
cars = ['audi','bmw','subaru','toyota']
for car in cars:
if car == 'bmw':
#这行第一次编译失败,有不识别的字符,应该注意全英文输入
print(car.upper ())
else:
print(car.title())
#if-else
age = 12
if age < 4:
print("Your admission cost is $0.")
elif age < 18:
print("Your admission cost is $5." )
else:
print("Your admission cost is $10.")
#检查特定值是否包含在列表中用in或者not in
banned_users = ['andrew','carolina','david']
user = 'marie'
if user not in banned_users:
print(user.title() + ",you can post a response if you wish!")
本文代码来自《python编程》
今天就传两段小代码吧!
#if条件语句的学习和用法
cars = ['audi','bmw','subaru','toyota']
for car in cars:
if car == 'bmw':
#这行第一次编译失败,有不识别的字符,应该注意全英文输入
print(car.upper ())
else:
print(car.title())
#if-else
age = 12
if age < 4:
print("Your admission cost is $0.")
elif age < 18:
print("Your admission cost is $5." )
else:
print("Your admission cost is $10.")
#检查特定值是否包含在列表中用in或者not in
banned_users = ['andrew','carolina','david']
user = 'marie'
if user not in banned_users:
print(user.title() + ",you can post a response if you wish!")
本文代码来自《python编程》
相关文章推荐
- Python学习第三天(一个简单制作导入模块)
- python第三天 随机数,not 使用
- On the third day learning Python(第三天学习Python)
- Python 学习第三天
- python第三天学习笔记(布尔值)
- python第三天
- 学习python第三天
- python学习---第三天
- Python第三天课后作业
- Python第三天。
- 《python tutorial》--python 学习第三天
- python学习之路-第三天-函数
- Python第三天课后作业
- 编程语言之python学习第三天
- python的第三天
- Python学习第三天----Linux基础命令
- 《python tutorial》--python 学习第三天
- python 11期 第三天
- Python 第三天
- Python入门学习笔记第三天