我正在尝试通过简单的 python 项目帮助我的儿子。我们没有太多经验,所以请尽量简单地解释。我们写了几个问题,一旦问题结束,如果用户想再次玩,那么它将把他带到开始......有人可以帮忙吗?我们试图得到: 1. 如果用户输入“是”,那么它将带他到开始,程序将重新启动.. 2. 如果他输入“否”,它将给出一条消息:“谢谢....”,如果可能,将退出/关闭屏幕...
这是代码:
# Starting of the code
import time
import random
def displayIntro():
print('Hello! My name is John. What is your name?')
myname = input()
print ('Well, ' +myname + ' This program is all about skin cancer.')
# some question below
#End of the code
playagain = 'yes'
while playagain == 'yes':
displayIntro()
print('Do you want to play again? (yes or no)')
playAgain = input()
谢谢你。