I have this code, but i dont know how to use the "age" from the user in the other function any clue what i have wrong?
def accounts():
yourCode = input("Please enter your user code.
If you already have an account, type your account user code.
Otherwise, enter a new one to create an account: ")
with open("users.txt", "r") as rf:
users = rf.readlines()
for each_user in [user.split(",") for user in users]:
if each_user[0] == yourCode:
print(f"Welcome {each_user[1]}")
age = each_user[2]
xxApp()
return None
with open("users.txt", "a") as af:
name = input("Please enter your name: ")
age = input("Enter your age: ")
af.write(f"{yourCode},{name},{age}
")
print(f"Thank you {name}, your information has been added.")
xxApp()
def xxApp():
age = each_user[2]
print(age)
question from:
https://stackoverflow.com/questions/65862212/use-values-from-another-function-python3 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…