- 博客(4)
- 收藏
- 关注
原创 8-6 城市名(改动版)
8-6城市名:编写一个名为city_country()的函数,它接受城市的名称及所属的国家。这个函数应该返回一个格式类似于下面这样的字符串: “中国,成都” 至少使用三个城市-国家对调用这个函数,并打印它返回的值 def city_country(city,country): mix = city + ',' + country return mix.title() while True: first = input('what is the city?') if first == 'q':
2021-09-11 17:03:42
236
原创 哈,一段问好程序!(今天的我,是优(you)质(zhi)的我)
乱写的代码 噗呲~ 问完名字说哈罗 哈喽说完还有否 选择图表看一看 看完也可退出咯 def greet_user(username): print ('hello!' + username.title() + '!') names = [] active = True while active: name = input('what is your name? ' '\nOr you can choose quit to quit and the chart to check the chart.
2021-09-10 21:37:30
115
原创 python编程:从入门到实践 7-8、7-10
7-8 熟食店: 创建一个名为 sandwich_orders 的列表,在其中包含各种三明治的名 字; 再创建一个名为 finished_sandwiches 的空列表。 遍历列表 sandwich_orders,对于 其中的每种三明治,都打印一条消息,如 I made your tuna sandwich,并将其移到列表 finished_sandwiches。 所有三明治都制作好后,打印一条消息,将这些三明治列出来。 (暂) sandwich_orders = ['a_sandwich','b_sand
2021-09-08 22:55:17
370
原创 python编程:从入门到实践 7-5(1)
7-5 电影票 : 有家电影院根据观众的年龄收取不同的票价: 不到3岁的观众免费; 3~12岁的观众为10美元; 超过12岁的观众为15美元。 请编写一个循环, 在其中询问用户的年龄, 并指出其票价。 (1)使用变量active来控制循环结束的时机 个人巧记(纯active) active = True while active: age = input('Your age is ') if age == 'quit': print ('akready quit') active = False
2021-09-08 15:38:18
329
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人