必須制作一個運行功能的表。我可以運行一次函式,但是在能夠提交另一個函式之后,代碼就結束了。
def main():
menu()
option=int(input('What option do you choose? '))
if option==1:
rol()
if option==2:
bing()
if option==3:
return
else:
print('Please pick from the menu!')
menu()
option=int(input('What option do you choose? '))
How do I loop it so that after it goes through the options roll() and bingo(), and the menu is shown again, it actually goes through with the functions?
uj5u.com熱心網友回復:
這是代碼,以便它永遠回圈:
def main():
while True:
print('Please pick an option from the menu!')
menu()
option = int(input('What option do you choose? '))
if option == 3:
return
if option == 1:
roll()
elif option == 2:
bingo()
uj5u.com熱心網友回復:
假設你的 main 函式只運行一次,你可以簡單地在外部運行回圈
def main():
# your code ...
if __name__ == "__main__":
while True:
main()
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/432753.html
