Hi I recently had this program running fine but after fiddling round with it now it doesn't work because when the program asks "do you want to enter a user" and type "yes" it doesn't ask for the user to input the data it just goes onto "do you want to see your records?" If anyone could help quick it would be much appreciated p.s im really new so im not 100% understand some things atm
def openfile1(name,dob,time,postcode): file=open('runnerdata.txt', 'a') file.write(name+":") file.write(dob+":") file.write(time+":") file.write(postcode+ ":\n") file.close()
while True: enter=input("Do you want to enter a user? ") if enter=="no": file=open('runnerdata.txt', 'r') list=(file.readlines())
enter2=input("Do you want to see your records? ")
if enter2=="no":
break
if enter2=="yes":
name2=input("Enter name to see your records ")
for line in list:
if line.split(":")[0]==name2:
print(line)
elif enter=="yes":
name=input("Enter name ")
dob=input("Enter your DOB in form 00/00/0000 ")
time=input("Enter your run time ")
postcode=input("Enter your postcode ")
openfile1(name,dob,time,postcode)
Aucun commentaire:
Enregistrer un commentaire