. 당신이 내 코드를 보면 나는 이러한 오류를 해결 한 그것은 몇 가지 버그가
import os
print("\nWelcome, enter Your name please")
name = input("--> ")
def username(name): #NAME
while len(name) < 2:
print("There was an error")
name = input("\nPlease enter Your name again -->")
else:
print("Hello,", name)
username(name)
def menu(): #MENU
print("\nWelcome to the menu")
print("From here You can chose the game")
print("For now, we have only 3 game but there will be plenty more!")
print("Chose game by it's number ")
print("1 - Coin flip| 2 - Horse racing| 3 - Loto|")
menu()
game = int(input("--> "))
def choice(game): #CHOOSING GAME
while game > 3 or game < 1:
print("\nSomething went wrong, enter game you want again (only numbers 1, 2, 3!")
game = int(input("--> "))
if game == '1': #if statement first and two "=" signs
print("You chose Coin flip game")
os.system('python coinflip.py')
elif game == '2': #use tab to indent properly
print("You chose Horse racing game")
os.system('python horseracing.py')
elif game == '3': #keep indentations the same throughout
print("You chose Loto game")
os.system("python loto.py")
choice(game)
당신이 그들이'if'가 선행 될 필요가 맨'elif' 문을 가질 수 없습니다 원인이되었을 들여 쓰기를 고정. 그 외에도,'if'는'='를 사용하고'='를 사용하여 대입 연산자를 사용하지 않아야합니다. –