Python_Leaner
Python_Leaner
2019-03-11 15:35

哪位大佬能告诉我在python中打的这些代码为什么退不出循环,万分感谢?

  • python

def get_name(first_name,last_name):
'''返回整洁的姓名'''
full_name = first_name + " " + last_name
return full_name.title()
home = True#我设置的标志
while home:#标志为True时循环
print("\nPlease tell me your name !")
f_name = input("First name:")#输入_1
l_name = input("Last name:")#输入_2
names = get_name(f_name,l_name)
print("Hello, " + names + "!")
out = input("When you fish or not zhe reserch,input yes/no")#输入_3
if out.title() == 'yes':#判断out这个输入是否为‘yes’
home = False#是,则将False赋值给标志home
else:
print("One more time!")

#但是结果却是,当我在输入_3输入 yes时,并没有跳出while循环,而是继续循环,让我输入 输入_1

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

3条回答