# Program def main(): try: # Create a while loop to allow the user to restart the program # Ask the user for the filename filename = input("Filename: ") while True: # read / write / append # r read > reads a file # w write > ALWAYS write a NEW file # a append > appends to the EOF # open the file using a var and a parameter myFile = open(filename, 'a') # Ask the user what to write to the file newData = input("New Data: ") allData = newData + '\n' # Write the new data to the file myFile.write(allData) # Read the file myFile = open(filename, 'r') print(myFile.read()) # Ask the user if they want to add more data response = input("Do you want to add more data? (y/n) ") if response in ('y', 'yes', 'Y', 'YES', 'Yes'): continue # if response.lower() in ('y','yes): else: break except Exception as err: pass finally: print("Thank you for using the app") myFile.close() if __name__ == "__main__": # what function do you want to use to start the program main()