python课后习题 7-10

7-10 梦想的度假胜地:
编写一个程序,调查用户梦想的度假胜地。使用类似于“If you could visit one place in the world, where would you go?”的提示,并编写一个打印调查结果的代码块。

info={}
active=True

while active:
	name=input("Hi, what's your name? ")
	place=input("If you could visit one place in the world, where would you go? ")

	info[name]=place
	repeat=input("anyone else?(yes/no) ")
	if repeat=='no':
		active=False
print("\n------ poll result ------\n")
for name,place in info.items():
	print(name+ " would visit "+ place)

猜你喜欢

转载自blog.csdn.net/csdn317341539/article/details/88777694