第三周作业
2018-03-25 21:02
267 查看
5.6 age = 13 if age < 2: print("He is a baby") elif age >= 2 and age < 4: print("He is learning to walk") elif age >= 4 and age < 13: print("He is a child") elif age >= 13 and age < 20: print("He is a teenger") elif age >= 20 and age < 65: print("He is an adult") elif age >= 65: print("He is an old") 5.7 favorite_fruits = ["apple", "banana", "pear"] if "apple" in favorite_fruits: print("You really like apples!") if "orange" in favorite_fruits: print("You really like oranges!") if "banana" in favorite_fruits: print("You really like bananas!") if "strawberry" in favorite_fruits: print("You really like strawberrys!") if "pear" in favorite_fruits: print("You really like pears!") 5.11 nums = range(1, 9 + 1) for num in nums: if num == 1: print(str(num) + "st") elif num == 2: print(str(num) + "nd") elif num == 3: print(str(num) + "rd") else: print(str(num) + "th") 6.1 person = { 'first_name': 'chen', 'last_name': 'pengyu', 'age': '20', 'city': 'Guangzhou', } print("He is " + person['first_name'].title() + " " + person['last_name'].title() + ", and he is " + person['age'] + ' years old. And he lives in ' + person['city'].title() + ' city.') 6.8 dog_1 = {'kind': 'dog', 'host': 'lala'} cat_1 = {'kind': 'cat', 'host': 'sasa'} rabbit_1 = {'kind': 'rabbit', 'host': 'angle'} pets = [dog_1, cat_1, rabbit_1] for pet in pets: print(pet)
相关文章推荐
- DeepLearing学习笔记-Planar data classification with one hidden layer(第三周作业)
- 算法分析与设计课程作业第三周#1
- Coursera 吴恩达 Deep Learning 第二课 改善神经网络 Improving Deep Neural Networks 第三周 编程作业代码 Tensorflow Tutorial
- 第三周作业
- 《深度学习——Andrew Ng》第一课第三周编程作业
- AndrewNg机器学习第三周作业:关于验证自己得出的Hypothesis的准确度
- 第三周作业
- 第三周作业
- 第三周作业
- 吴恩达 DeepLearning 神经网络基础 第一课第三周编程题目及作业
- 第三周作业
- N26-第三周作业
- 第三周作业
- 高级编程技术 第三周作业
- 第三周作业-实现随机点名的签到程序 第五需求,头像版
- 第三周作业--实现随机点名的签到程序
- 第三周作业:判断是否闰年
- 我的C++第三周作业(第二章)
- 第三周作业
- 学习总结|Linux内核分析 第三周作业 - 网易云课堂