高级编程技术作业 (七)
2018-03-30 23:50
246 查看
7-1 汽车租赁 :编写一个程序,询问用户要租赁什么样的汽车,并打印一条消息,如“Let me see if I can find you a Subaru”。
type_car = input("what kind of car do you want to rant?")print("Let me see if I can find you a " + type_car)7-2 餐馆订位 :编写一个程序,询问用户有多少人用餐。如果超过8人,就打印一条消息,指出没有空桌;否则指出有空桌。
number = input("how many people will join the party?")if int(number) > 8: print('we have no empty chair')else: print('we have enough chair')7-3 10的整数倍 :让用户输入一个数字,并指出这个数字是否是10的整数倍。
number = input("please input a number")if int(number) % 10 == 0: print('this number is a multiplier of 10')else: print('this number is not a multiplier of 10')7-5 电影票 :有家电影院根据观众的年龄收取不同的票价:不到3岁的观众免费;3~12岁的观众为10美元;超过12岁的观众为15美元。请编写一个循环,在其中询问用户的年龄,并指出其票价。
while True: age = input('please input your age') if (age == 'q'): break elif (0 < int(age) <= 3): print('free') elif (3 < int(age) <= 12): print('you shoule pay for 10 $') elif (int(age) > 12): print('you should pay for 15 $') else: print('invaild input')
7-10 梦想的度假胜地 :编写一个程序,调查用户梦想的度假胜地。使用类似于“If you could visit one place in the world, where would you go?”的提示,并编写一个打印调查
结果的代码块。
hoilday_place = []while True: place = input('If you could visit one place in the world, where would you go?') if place == 'q': break else: hoilday_place.append(place)for place in hoilday_place: print(place + ' ')
type_car = input("what kind of car do you want to rant?")print("Let me see if I can find you a " + type_car)7-2 餐馆订位 :编写一个程序,询问用户有多少人用餐。如果超过8人,就打印一条消息,指出没有空桌;否则指出有空桌。
number = input("how many people will join the party?")if int(number) > 8: print('we have no empty chair')else: print('we have enough chair')7-3 10的整数倍 :让用户输入一个数字,并指出这个数字是否是10的整数倍。
number = input("please input a number")if int(number) % 10 == 0: print('this number is a multiplier of 10')else: print('this number is not a multiplier of 10')7-5 电影票 :有家电影院根据观众的年龄收取不同的票价:不到3岁的观众免费;3~12岁的观众为10美元;超过12岁的观众为15美元。请编写一个循环,在其中询问用户的年龄,并指出其票价。
while True: age = input('please input your age') if (age == 'q'): break elif (0 < int(age) <= 3): print('free') elif (3 < int(age) <= 12): print('you shoule pay for 10 $') elif (int(age) > 12): print('you should pay for 15 $') else: print('invaild input')
7-10 梦想的度假胜地 :编写一个程序,调查用户梦想的度假胜地。使用类似于“If you could visit one place in the world, where would you go?”的提示,并编写一个打印调查
结果的代码块。
hoilday_place = []while True: place = input('If you could visit one place in the world, where would you go?') if place == 'q': break else: hoilday_place.append(place)for place in hoilday_place: print(place + ' ')
相关文章推荐
- 《高级编程技术》作业[1]——python实现程序构想
- 《高级编程技术》作业[2]——第二章部分习题选做
- 高级编程技术作业第二周1 第三章课后练习
- 【高级编程技术】【作业】【第二周】【2】
- 高级编程技术第四次作业
- 高级编程技术(第五次作业)
- 高级编程技术作业第三周 第五章,第六章课后练习
- 高级编程技术_课后作业(五)
- 高级编程技术 课后作业七(第4周)
- 【高级编程技术】第四周作业
- 高级编程技术作业第四周 第七章课后练习
- 高级编程技术作业_9
- 高级编程技术第七、八次作业
- 高级编程技术 第四周作业
- 高级编程技术(Python)作业10
- 【高级编程技术】【作业】【第六周】【1】
- 高级编程技术第一次作业
- 高级编程技术第二周平时作业
- 《高级编程技术》第二周作业