I am trying to code my own food selector in python where people can pick if they want a tortilla in their wrap for example and the program will work out the costs.
One of the extra's I am trying to do is that, if the customer does not want to checkout immediately they can save their order to a text file. That all works perfectly but how do I rename this text file to the user_name
so that only their choices are displayed and so I know who has made these choices?
if order_save =="1":
f = open ("user_name.txt","w")
f.close()
if Tortilla_option == "yes":
f = open ("user_name.txt","a")
f.write("Tortilla")
f.close()
if Chicken_option == "yes":
f = open ("user_name.txt","a")
f.write("\nChicken")
f.close()
if Salad_option == "yes":
f = open ("user_name.txt","a")
f.write("\nSalad")
f.close()
if Chilli_option == "yes":
f = open ("user_name.txt","a")
f.write("\nChilli Sauce")
f.close()
print ("Here is your takeway that will be saved",user_name,"!\n")
f = open ("user_name.txt","r")
print(f.read())
f.close()