这个代码我有问题。它将正常运行,直到到达循环(def游戏)并在那里停止。我确实把它作为一个if语句,但它仍然不起作用。请注意,这可能有点混乱
import random
import time
GameInProgress = ("Yes")
TutorialDone = ("No")
ReplayGame = ("Yes")
#Test purposes
PlayerName = ("Lewis")
print ("Welcome to 'Guess The Word!")
def Game():
GameInProgress = ("Yes")
TutorialDone = ("No")
ReplayGame = ("Yes")
#Test purposes
PlayerName = ("Lewis")
print ("Welcome to 'Guess The Word!")
WordSelected=("No")
LettersGuessed=0
print (TutorialDone)
EnterName = input("Would you like to enter your name?").title()
def Game():
不是循环,它是一个函数,在您调用它之前它不会执行。 可以这样调用python函数Game()
如果要反复调用同一个函数,只需在for或while循环中调用函数:
如果你是初学者,请遵循一些教程 https://www.tutorialspoint.com/python/python_functions.htm
相关问题 更多 >
编程相关推荐