I have been wprking on this code today and the last process i have to do is to save the data i get to a .txt file, i am not sure how to do this and would greatly appreciate some help if at all possible, here is the code;
import random
char1=str(input('Please enter a name for character 1: '))
strh1=((random.randrange(1,12))//(random.randrange(1,4))+10)
skl1=((random.randrange(1,12))//(random.randrange(1,4))+10)
print('%s has a strength value of %s and a skill value of %s'%(char1,strh1,skl1))
char2=str(input('Please enter a name for character 2: '))
strh2=((random.randrange(1,12))//(random.randrange(1,4))+10)
skl2=((random.randrange(1,12))//(random.randrange(1,4))+10)
print('%s has a strength value of %s and a skill value of %s'%(char2,strh2,skl2))
I have researched the json function, but i am not sure how to use is because I want the data to be saved in a certain of 'char1(eg steve) has a stength of strh1(eg13) and a skill of skl1(eg21)' and then repeat this for the other character. If anyone could help me with this that would be really great, thanks !