#Code runs fine outside of function and doesn't inside it
7 messages · Page 1 of 1 (latest)
I'm not sure exactly what you are trying to do but you never call your function
Doesn't work, i did called function before posting here maybe missed in the post
What are you trying to do? There's some weird stuff going on here such as markX = bool
Your markX inside your function is different to the one outside. If you want to use the global markX you'd need to do global markX
markX = bool
n = 0
while True:
n = int(input('1. for X \n2. for O...'))
if n==1 or n==2:
break
def fff():
global markX
if n == 1:
markX = True
elif n == 2:
markX = False
return markX
fff()
print(markX)
Yes, thanks it worked