Python编程:从入门到实践第二版答案(第七章)
生活随笔
收集整理的這篇文章主要介紹了
Python编程:从入门到实践第二版答案(第七章)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
?7-1
car = input("which car do you want to lease? ") print(f"Let me see if i can find you a {car}")7-2
people = input("How many of you are there? ") people = int(people) if people <= 8:print("Welcome!") else:print("sorry,We don't have any tables available.")7-3
num = input("please input a number.And i will tell you if it is a multiple of 10: ") num = int(num) if num%10 == 0:print("it is a multiple of 10.") else:print("sorry,it is not a multiple of 10.")7-4
word = "" while word != "quit":word = input("Enter the pizza ingredients you want: ")if word != "quit":print(f"{word} will be added.")?7-5
while True:age = input("Your age: ")if age == "quit":breakage = int(age)if age < 3:print("You are free.ヽ(?゚▽゚)ノ")elif age < 13:print("Your ticket is 13.")else:print("Your ticket is 15")7-6
#使用active,另外兩項7-4 7-5均有使用 active = True while active:word = input("Enter the pizza ingredients you want: ")if word != "quit":print(f"{word} will be added.")else:active = False7-7
active = True while active:print('1')?7-8
Sandwich_orders = ['tuna', 'button', 'chicken'] finished_sandwich = [] while Sandwich_orders:sandwich = Sandwich_orders.pop()print(f"I made your {sandwich} sandwich.")finished_sandwich.append(sandwich) print(finished_sandwich)7-9
Sandwich_orders = ['pastrami', 'tuna', 'button', 'pastrami', 'chicken', 'pastrami'] print("The pastrami was sold olt.") while 'pastrami' in Sandwich_orders:Sandwich_orders.remove('pastrami') print(Sandwich_orders)7-10
active = True favorite_place = {} while active:name = input("what's your name? ")place = input("If you could visit one place in the world,where would you go: ")favorite_place[name] = placeans = input("Is there anyone next?(yes/no)")if ans == "no":break for name, place in favorite_place.items():print(f"{name} favorite place is {place}")總結
以上是生活随笔為你收集整理的Python编程:从入门到实践第二版答案(第七章)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ipa在线下载安装(itms-servi
- 下一篇: Python 内置容器 之 字典 ( d