Außerdem wird meine Zuweisung einer Variable durch "... = input('...')" ignoriert.
Dies soll ein Tic Tac Toe spiel werden.
Code: Alles auswählen
global starting_player
starting_player = "null" #welcher spieler ist an der Reihe
global stopvar #whileloop
stopvar = 1
global playerinput
playerinput = 0
def menu ():
starting_player = input("Welcher spieler soll anfangen? X oder O:")
if starting_player == "X" or "O":
while stopvar == 1:
game()
if starting_player != "X" or "O":
print('Falsche Eingabe.')
menu()
def game ():
playerinput = input('Bitte gebe deine Wahl ein "' + starting_player + '":')
if playerinput == range(9):
print("hello")
menu()
Vielen dank im voraus, Gruß Jakob.