Lilith
@Dofni
noodles
I already know how to save variables and such, but only if the variable is an integer (an example being health = 100). I can save it to a .py file and
Python
RYANTADIPARTHI name more of your variables global
Screenshot 2020-11-13 at 2.45.17 PM
Name more, and do the same thing you were doing.
2 years ago
Coder100 well yeah, you forgot to add a global for name. change your code to:
def save():
global o, name, fav_code, age
#open the file
o = open('save.txt', 'w')
o.write(name + ' ' + fav_code + ' ' + str(age) + ' ' + moo)
#make sure to close the file
o.close()
`2 years ago