Hi everyone, I'm making some kind of game in Python and i need to save random number to text file but i cant. Please help me out. Here is the code:
def lvl():
x = random.randint(100,1000)
tfile = open("text.txt", 'w')
tfile.write(x)
input("")
Without x everything is good, but i need to save variable. Thanks.