import random
game = False
random_num = random.randint(1 , 100)
print(random_num)
x = 0
if x == 1:
game = True
def code():
if number == random_num :
x + 1
print('you von')
elif number > random_num :
print('lov')
elif number < random_num :
print('higher')
if game == True:
print ("game over")
while x == 0:
number = int(input("Guess the number "))
code()
code should end if the correct number is guessed game over is never printed keeps asking me to guess the number
i also tried this code it keeps failing pycharm greys out-> game in if function game = True
import random
game = False
random_num = random.randint(1 , 100)
print(random_num)
#x = 0
#if x == 1:
#game = True
def code():
if number == random_num :
game = True
print('you von')
elif number > random_num :
print('lov')
elif number < random_num :
print('higher')
if game == True:
print ("game over")
while game == False:
number = int(input("Guess the number "))
code()