from ProcessingClasses import FileProcessor as FPClass from IOClasses import EmployeeIO as IOClass else: raise Exception("This file was not created to be imported.") empList = [] # list of employees # On load, read data from text file and append each row to data list in context readfile = FPClass.read_data_from_file("EmployeeData.txt") for row in readfile: empList.append(EmployeeClass(row[0], row[1], row[2].strip())) # Operations while True: IOClass.print_menu_items() # display menu choice = IOClass.input_menu_options() # determine choice if choice == "1": IOClass.print_current_list_items(empList) # print data list in context continue elif choice == "2": dataAdded = IOClass.input_employee_data( ) # execute input_employee_data to determine data to be added empList.append(dataAdded) # add employee data to data list in context continue elif choice == "3": FPClass.save_data_to_file("EmployeeData.txt", empList) # save data list in context to file continue elif choice == "4": break # exit program
# Show user a menu of options Eio.print_menu_items() # Get user's menu option choice choice = Eio.input_menu_options() # Show user current data in the list of employee objects if choice.strip() == '1': for each_object in lstTable: print(each_object) continue # Let user add data to the list of employee objects elif choice.strip() == '2': new_obj = Eio.input_employee_data() Dp.add_data_to_list(new_obj, lstTable) continue # let user save current data to file elif choice.strip() == '3': Fp.save_data_to_file("EmployeeData.txt", lstTable) print("Data has been saved.") continue # Let user exit program elif choice.strip() == '4': if input("Are you sure you want to exit? y/n: ").lower() == "y": break else: continue
strFileName = "EmployeeData.txt" lstEmployeeTable = [] # A list/table of Employee objects lstFileData = [] # A list/table of string objects in a list # TODO: Add Data Code to the Main body (DONE) # Load data from file ionto a list of employee objects when sripts starts lstFileData = Fp.read_data_from_file("EmployeeData.txt") for row in lstFileData: lstEmployeeTable.append(Emp(row[0], row[1], row[2].strip())) # Show user a menu of options while True: Eio.print_menu_items() strOption = Eio.input_menu_options() # Get users menu option choice if strOption == "1": # Show user current data in the list of employee objects Eio.print_current_list_items(lstEmployeeTable) continue elif strOption == "2": lstEmployeeTable.append(Eio.input_employee_data( )) # Lets user add data to the list of employee objects continue elif strOption == "3": Fp.save_data_to_file( "EmployeeData.txt", lstEmployeeTable) #Lets user save current data to file continue elif strOption == "4": #Exit Program break # Main Body of Script--------------------------------------------------#
# data file_name = "EmployeeData.txt" empList = [] fileList = Fp.read_data_from_file(file_name) # pull data from file into list for row in fileList: empList.append(Emp(row[0], row[1], row[2].strip())) # main script using modules while True: # menu handling EmpIo.print_menu_items() usrCh = EmpIo.input_menu_options() # show current employees if usrCh == "1": EmpIo.print_current_list_items(empList) # user add employees elif usrCh == "2": empList.append(EmpIo.input_employee_data()) # save current data to file elif usrCh == "3": Fp.save_data_to_file("EmployeeData.txt", empList) print("Data was saved") else: print("Exiting Program") break
try: file_name = "EmployeeData.txt" list_of_employees = [] input = None # Load data from file into a list of employee objects when script starts lstFileData = Fp.read_data_from_file(file_name) for line in lstFileData: list_of_employees.append(E(line[0], line[1], line[2].strip())) # Show user a menu of options while (True): Eio.print_menu_items() # Get user's menu option choice input = Eio.input_menu_options() # Show user current data in the list of employee objects if input == "1": Eio.print_current_list_items(list_of_employees) # Let user add data to the list of employee objects elif input == "2": new_data = Eio.input_employee_data() list_of_employees.append(new_data) print("New employee data successfully added!") # let user save current data to file elif input == "3": print(Fp.save_data_to_file(file_name, list_of_employees)) # Let user exit program elif input == "4": break except Exception as e: print(e, e.__doc__, type(e), sep="\n") # Main Body of Script ---------------------------------------------------- #
print("Data read in from text file: ") for row in lstTable: print("\t" + row.to_string(), type(row)) # Show user a menu of options while(True): Eio.print_menu_items() # Get user's menu option choice strChoice = Eio.input_menu_options() # Show user current data in the list of employee objects if strChoice == "1": Eio.print_current_list_items(lstTable) # Let user add data to the list of employee objects elif strChoice == "2": newEmp = Eio.input_employee_data() lstTable.append(newEmp) # let user save current data to file elif strChoice == "3": P.FileProcessor.save_data_to_file("EmployeeData.txt",lstTable) print("Data Saved!") # Let user exit program elif strChoice == "4": yn = input("Are you sure you would like to exit the program? [y/n]") #double checks if user wants to leave program if yn.lower() == "y": print("Exiting Program. Goodbye.") break #Exit program elif yn.lower() == "n": continue #choose another menu item # Invalid menu input else:
while True: # While loop to let user choose their menu option Eio.print_menu_items() #Calls print_menu_items # Get user's menu option choice strChoice = Eio.input_menu_options() #Assigns the input of the menu option to strChoice # Show user current data in the list of employee objects if strChoice.strip() == "1": Eio.print_current_list_items(lstOfEmployeeObjects) #Prints list of employee objects continue # Takes us back to the main menu # Let user add data to the list of employee objects if strChoice.strip() == "2": while True: # While loop to let user add names try: objEmployee = Eio.input_employee_data() #Creates objEmployee lstOfEmployeeObjects.append(objEmployee) #Appends print(objEmployee.first_name + " " + #Prints statement to user objEmployee.last_name + " has been added." + #Let's user know the name has been added str(objEmployee.employee_id) + "\n", type(objEmployee)) except Exception as e: print("\n", e, "\n") print("\t** Error - Cannot Create Employee **\n") #Prints statement to user finally: break # Exits the loop continue # Takes us back to the main menu # let user save current data to file if strChoice.strip() == "3":
# 1) Show current employee data # 2) Add new employee data. # 3) Save employee data to File # 4) Exit program # ''' # Get user's menu option choice choice = Eio.input_menu_options() # Show user current data in the list of employee objects if choice == '1': Eio.print_current_list_items(lstEmployeeTable) continue # Let user add data to the list of employee objects elif choice == '2': employee_input = Eio.input_employee_data() lstEmployeeTable.append(employee_input) print(employee_input, "\nThis entry has been added to the list!\n\n") continue # let user save current data to file elif choice == '3': Fp.save_data_to_file(fileName, lstEmployeeTable) print("Your data was saved to: " + fileName) continue # Let user exit program elif choice == '4': break
Eio.print_menu_items() # Get user's menu option choice choice = Eio.input_menu_options() if choice == "1": # Show user current data in the list of employee objects if currentList != []: # Check if there is any data in the list Eio.print_current_list_items(currentList) input("Press Enter to return to the Menu.") else: print("The list is currently empty.") input("Press Enter to return to the Menu.") elif choice == "2": # Let user add data to the list of employee objects try: # Check for a user input that doesn't obey properties objP1 = Eio.input_employee_data() currentList.append(objP1) except UnboundLocalError: # Let the user know they need to re-input their data print("Please try again.") input("Press Enter to return to the Menu.") elif choice == "3": # let user save current data to file x = P.save_data_to_file(strFileName, currentList) if x == True: print("Your data was saved successfully.") input("Press Enter to return to the Menu.") elif choice == "4": # Let user exit program print("Thank you for using the program") input("Press Enter to Exit.") break else:
# Load data from file into a list of employee objects when script starts fileData = Fp.read_data_from_file(File) for line in fileData: lstEmpObj.append(Emp(line[0], line[1], line[2].strip())) # Show user a menu of options while True: Eio.print_menu_items() userChoice = Eio.input_menu_options() if userChoice.strip() == '1': # Show current employee data Eio.print_current_list_items(lstEmpObj) elif userChoice.strip() == '2': # Add new employee data lstEmpObj.append(Eio.input_employee_data()) print('Employee added, press 3 to save this data to file!') elif userChoice.strip() == '3': # Save employee data to File Fp.save_data_to_file(File, lstEmpObj) print("Employee data saved to file!") elif userChoice.strip() == '4': # Exit Program print("Goodbye!") break # Get user's menu option choice # Show user current data in the list of employee objects # Let user add data to the list of employee objects # let user save current data to file # Let user exit program
for row in lst_file_data: lst_emp_table.append(Emp(row[0],row[1],row[2].strip())) # Show user a menu of options while True: Eio.print_menu_items() # Get user's menu option choice str_choice = Eio.input_menu_options() if str_choice == "1": # Show user current data in the list of employee objects Eio.print_current_list_items(lst_emp_table) continue elif str_choice == "2": # Let user add data to the list of employee objects lst_emp_table.append(Eio.input_employee_data()) print("Employee Data Added.") continue elif str_choice == "3": # let user save current data to file Fp.save_data_to_file("EmployeeData.txt", lst_emp_table) print("Employee Data Saved.") continue elif str_choice == "4": # Let user exit program print(""" ************************* You've exited the program ************************* """) break
# Show user a menu of options # Get user's menu option choice while True: Eio.print_menu_options() strChoice = Eio.input_menu_options() # Show user current data in the list of employee objects if strChoice == "1": Eio.print_current_list_employees(list_of_objects) Eio.input_press_to_continue() continue # Let user add data to the list of employee objects elif strChoice == "2": print(Eio.input_employee_data(list_of_objects)) Eio.input_press_to_continue() continue # let user save current data to file elif strChoice == "3": P.FileProcessor.save_data_to_file("EmployeeData.txt", list_of_objects) Eio.input_press_to_continue() continue # let user read current data from file elif strChoice == "4": fileData = P.FileProcessor.read_data_from_file("EmployeeData.txt") list_of_objects.clear() for line in fileData: list_of_objects.append(Emp(line[0], line[1], line[2].strip()))
try: # Use this Processor function to read a text file and return a table of data lstTable = Fp.read_data_from_file(strFileName) # read file data Eio.print_intro() # print the script intro here while True: Eio.print_menu_items() # print the menu here strChoice = Eio.input_menu_options() # Get menu option # Process user's menu choice if strChoice.strip() == '1': # Print the Employee Information Eio.print_current_list_items( lstTable) # <<Print the list of employees here Eio.input_press_to_continue() # send a message to the user elif strChoice == '2': # Enter New Employee ID's and names while True: # Use a While loop to allow for continued data entry # Use this Eio function to input a new Employee Id and Name Info strNewEmp = Eio.input_employee_data( lstTable) # Input New Employee Info here strEmpInfo = str( strNewEmp ) # Took the returned Employee info and set to this string variable here empID, empFirstName, empLastName = strEmpInfo.split( ",") # Split out the various string pieces here # Print show the data for the new employee that was added print("New Employee Added: " + "ID: " + empID + " - " + empFirstName + " " + empLastName) # Evaluate the user choice and exit loop if "n" in response if "n" in Eio.input_yes_no_choice(): print() # Add a line here for readability # Exit the loop and go to the Main Menu break else: print()
from IOClasses import EmployeeIO # Test data module - class Person objP1 = Person("Bob", "Smith") objP2 = Person("Sue", "Jones") lstTable = [objP1, objP2] for row in lstTable: print(row.to_string(), type(row)) # Test data module - class Employee objP1 = Employee(1, "Bob", "Smith") objP2 = Employee(2, "Sue", "Jones") lstTable = [objP1, objP2] for row in lstTable: print(row.to_string(), type(row)) # Test processing module - class FileProcessor FileProcessor.save_data_to_file("EmployeeData.txt", lstTable) lstFileData = FileProcessor.read_data_from_file("EmployeeData.txt") lstTable.clear() for line in lstFileData: lstTable.append(Employee(line[0], line[1], line[2].strip())) for row in lstTable: print(row.to_string(), type(row)) # Test IO module - class EmployeeIO EmployeeIO.print_menu_items() EmployeeIO.print_current_list_items(lstTable) print(EmployeeIO.input_employee_data()) print(EmployeeIO.input_menu_options())
lstFileData = Fp.read_data_from_file(strFileName) # read file data for row in lstFileData: # put data in consumable format lstOfEmployees.append(Emp(row[0], row[1], row[2].strip())) while True: # Show user a menu of options Eio.print_menu_items() # Get user's menu option choice strChoice = Eio.input_menu_options() if strChoice.strip() == '1': # Print Employees listed in the file (if any) Eio.print_current_list_items(lstOfEmployees) continue elif strChoice.strip() == '2': # Let user add data to the list of employee objects lstOfEmployees.append(Eio.input_employee_data()) continue elif strChoice.strip() == '3': # Let user save current data to file Fp.save_data_to_file(strFileName, lstOfEmployees) continue elif strChoice.strip() == '4': # Let user exit program break else: # Add a catch all for invalid entries print("That option is not valid. Please select 1-4") continue except Exception as e: print("There was an error!") print(e, e.__doc__, type(e), sep='\n') sys.exit(1)
lstFile = FP.read_data_from_file('EmployeeData.txt') lstTable = [] for line in lstFile: lstTable.append(EMP(line[0].strip(), line[1].strip(), line[2].strip())) # Show user a menu of options while (True): try: IO.print_menu_items() # Get user's menu option choice option = IO.input_menu_options() # Show user current data in the list of employee objects if option == '1': IO.print_current_list_items(lstTable) # Let user add data to the list of employee objects elif option == '2': lstTable.append(IO.input_employee_data()) # let user save current data to file elif option == '3': FP.save_data_to_file('EmployeeData.txt', lstTable) # Let user exit program elif option == '4': print('Thanks, goodbye') break else: print('Please enter a valid choice.') except ValueError as e: print(e) # Main Body of Script ---------------------------------------------------- #
while True: Eio.print_menu_items() # Get user's menu option choice strChoice = Eio.input_menu_options() # Show current employee data to user if strChoice.strip() == "1": Eio.print_current_list_items(lstOfEmployeeObjects) continue # Let user add new employee data if strChoice.strip() == "2": while True: # While loop prevents being kicked back to main menu during error try: objEmployee = Eio.input_employee_data() lstOfEmployeeObjects.append(objEmployee) print( objEmployee.first_name + " " + objEmployee.last_name + " has been added with Employee ID #" + str(objEmployee.employee_id) + "\n", type(objEmployee)) except Exception as e: print("\n", e, "\n") print("\t** Error - Cannot Create Employee **\n") except UnboundLocalError: print() # Add line for looks print("\t** Error - Cannot Create Employee **\n") finally: break continue
# Data lstTable = [] # Main Body of Script ---------------------------------------------------- # # Load data from file into a list of employee objects when script starts lstFileData = Fp.read_data_from_file("EmployeeData.txt") lstTable.clear() for line in lstFileData: lstTable.append(Emp(line[0], line[1], line[2].strip())) while True: # Show user a menu of options Eio.print_menu_items() # Get user's menu option choice choice = Eio.input_menu_options() if choice == "1": # Show user current data in the list of employee objects Eio.print_current_list_items(lstTable) elif choice == "2": # Let user add data to the list of employee objects EmpEntered = Eio.input_employee_data() lstTable.append(EmpEntered) elif choice == "3": # let user save current data to file Fp.save_data_to_file("EmployeeData2.txt", lstTable) elif choice == "4": # Let user exit program break else: raise Exception("Invalid input. Enter 1-4 only!") # End of Main Body of Script ---------------------------------------------------- #
# Test writing to PersonData.txt FP.save_data_to_file("EmployeeData.txt", lstTable) lstFileData = FP.read_data_from_file("EmployeeData.txt") lstTable.clear() for line in lstFileData: lstTable.append(EMP(line[0], line[1], line[2].strip())) for row in lstTable: print(row.to_string()) # Test IO class cont = True while cont == True: EIO.print_menu_items() strChoice = EIO.input_menu_options() if strChoice == "1": for row in lstTable: print(row.to_string()) elif strChoice == "2": EmpInput = [] EmpInput = EIO.input_employee_data() lstTable.append(EmpInput) for row in lstTable: print(row.to_string()) elif strChoice == "3": FP.save_data_to_file("EmployeeData.txt",lstTable) print("Data was saved to file") elif strChoice == "4": cont = False print("Goodbye") exit()
raise Exception("This file was not created to be imported.") # test data processing module - create person per1 = PersonConst("Test", "Person") testPeople = [per1] for row in testPeople: print(row.to_string(), type(row)) # test data processing module - create employee emp1 = EmployeeConst(1, "Beau", "Barth") emp2 = EmployeeConst(2, "Dana", "Barth") testData = [emp1, emp2] for row in testData: print(row.to_string(), type(row)) # test file processing - save data FPClass.save_data_to_file("EmployeeData.txt", testData) # test file processing - read data readfile = FPClass.read_data_from_file("EmployeeData.txt") # read from file testData.clear() # clear testData before append, print for row in readfile: testData.append(EmployeeConst( row[0], row[1], row[2].strip())) # converts row to employee object for row in testData: print(row.to_string(), type(row)) # test employee IO processing - get new employee testEmployee = EmpIO.input_employee_data() print(testEmployee)
for line in lstFileData: lstOfEmployeeRows.append(E(line[0], line[1], line[2].strip())) # add data to list # Show user a menu of options while True: eIO.print_menu_items() # Get user's menu option choice strChoice = eIO.input_menu_options() # Show user current data in the list of employee objects if strChoice.strip() == '1': eIO.print_current_list_items(lstOfEmployeeRows) # Let user add data to the list of employee objects elif strChoice.strip() == '2': objEmployee = eIO.input_employee_data() lstOfEmployeeRows.append(objEmployee) # add object to list # Let user save current data to file elif strChoice.strip() == '3': FP.save_data_to_file(strFileName, lstOfEmployeeRows) # Let user exit program elif strChoice.strip() == '4': break # and exit else: print('Please enter a choice from 1 to 4.')
try: # check that code will run strChoice = Eio.input_menu_options() # store user's selection except Exception as e: # exception handled print(e) # print error message # Show user current data in the list of employee objects if strChoice == '1': # checks if user entered 1 Eio.print_current_list_items( lstObjTable) # print current list of employees input("Press [Enter] key to return to the menu. " ) # print message to continue # Let user add data to the list of employee objects elif strChoice == '2': # checks if user entered 2 try: # check that code will run lstObjTable.append(Eio.input_employee_data() ) # ask user to input new employee data except Exception: # exception handles print("Something went wrong inputting employee data." ) # custom error message print("New employee info input complete." ) # let user know employee data input is complete input("Press [Enter] key to return to the menu. " ) # print message to continue # let user save current data to file elif strChoice == '3': # checks if user entered 3 Fp.save_data_to_file(fn, lstObjTable) # save list of objects to file print("Employee data saved to file." ) # let user know employee data was saved input("Press [Enter] key to return to the menu. "
# Main Body of Script ---------------------------------------------------- # # Load data from file into a list of employee objects when script starts lstEmployeeData = Fp.read_data_from_file(strFileName) while True: # Show user a menu of options Eio.print_menu_items() # Get user's menu option choice strChoice = Eio.input_menu_options() # get menu option # Show user current data in the list of employee objects if strChoice == "1": Eio.print_current_list_items(lstEmployeeData) # Let user add data to the list of employee objects elif strChoice == "2": objEmp = Eio.input_employee_data() # create new employee object lstEmployeeData.append( objEmp) # append to existing list of employee objects # let user save current data to file elif strChoice == "3": Fp.save_data_to_file(strFileName, lstEmployeeData) print("Data Saved") # Let user exit program elif strChoice == "4": print("Ending Program") break else: print("Make a choice from 1 to 4") continue # Main Body of Script ---------------------------------------------------- #
for line in lstFileData: lstTable.append(Emp(line[0], line[1], line[2].strip())) for row in lstTable: print(row.to_string(), type(row)) while (True): #Eio.print_current_list_items(lstTable) # Show current data in the list/table Eio.print_menu_items() # Show user a menu of options strChoice = Eio.input_menu_options() # Get user's menu option choice if strChoice == '1': # Add a new Task Eio.print_current_list_items(lstTable)# Show user current data in the list of employee objects continue # to show the menu elif strChoice == '2': #add new employee data print(Eio.input_employee_data()) # print new employee continue # to show the menu elif strChoice == '3': # # let user save current data to file #p.save_data_to_file("PersonData.txt", lstTable) Fp.save_data_to_file("EmployeeData.txt", lstTable) lstFileData = Fp.read_data_from_file("EmployeeData.txt") lstTable.clear() for line in lstFileData: lstTable.append(Emp(line[0], line[1], line[2].strip())) for row in lstTable: print(row.to_string(), type(row)) continue # to show the menu # Let user exit program elif strChoice == '4': # Exit Program
# Main Body of Script ---------------------------------------------------- # # Read in current file and build a list of objects lstFileData = Fp.read_data_from_file(strFileName) lstOfEmployeeObjects.clear() for line in lstFileData: lstOfEmployeeObjects.append(Emp(line[0], line[1], line[2].strip())) while (True): eIO.print_menu_items() # show user the menu strChoice = eIO.input_menu_options() # Process user's menu choice if strChoice.strip() == '1': # Show Current list of products eIO.print_current_list_items(lstOfEmployeeObjects) continue # to show the menu elif strChoice == '2': # Add new employee data try: lstOfEmployeeObjects.append(eIO.input_employee_data()) except Exception as e: raise print(e) continue # to show the menu elif strChoice == '3': # Save Data to File Fp.save_data_to_file(strFileName, lstOfEmployeeObjects) continue # to show the menu elif strChoice == '4': # Exit Program print("Goodbye!") break # and Exit
# Show user a menu of options while True: Eio.print_menu_item() # Get user's menu option choice strChoice = Eio.input_menu_options() # Show user current data in the list of employee objects if strChoice == "1": Eio.print_current_list_items(lstEmployeeTable) continue # Let user add data to the list of employee objects elif strChoice == "2": lstEmployeeTable.append(Eio.input_employee_data()) continue # let user save current data to file elif strChoice == "3": if("y" == str(input("Would you like to save data to file? (y/n): ")).strip().lower()): Fp.save_data_to_file("EmployeeData.txt", lstEmployeeTable) input("Data was saved to file. Press the [Enter] key to return to menu.") else: input("New data was NOT saved to file. Press the [Enter] key to return to menu.") continue # Let user exit program elif strChoice == "4": input("Press the [Enter] key to end program.") break
return "Please choose from menu: option 1, 2, 3, or 4." # initialize variables strFileName = "EmployeeData.txt" # Load data from file into a list of employee objects when script starts lstEmployees = FileProcessor.read_data_from_file(strFileName) EmployeeIO.print_current_list_items(lstEmployees) # Show user a menu of options while True: try: EmployeeIO.print_menu_items() intUserChoice = int(EmployeeIO.input_menu_options()) if intUserChoice == 1: EmployeeIO.print_current_list_items(lstEmployees) elif intUserChoice == 2: newEmployee = EmployeeIO.input_employee_data() lstEmployees.append(newEmployee) elif intUserChoice == 3: FileProcessor.save_data_to_file(strFileName, lstEmployees) elif intUserChoice == 4: break else: raise InvalidChoice() except ValueError as e: print("Please choose number from options above!") except Exception as e: print("There was an error. The built in message from Python is:") print(e)
# RRoot,1.1.2030,Created started script # RShip 12.16.20 used template to complete scrip. # ---------------------------------------------------------- # if __name__ == "__main__": from DataClasses import Employee as Emp from ProcessingClasses import FileProcessor as Fp from IOClasses import EmployeeIO as Eio else: raise Exception("This file was not created to be imported") # Test data module objP1 = Emp(1, "Bob", "Smith") objP2 = Emp(2, "Sue", "Jones") lstTable = [objP1, objP2] for row in lstTable: print(row.to_string(), type(row)) # Test processing module Fp.save_data_to_file("EmployeeData.txt", lstTable) lstFileData = Fp.read_data_from_file("EmployeeData.txt") lstTable.clear() for line in lstFileData: lstTable.append(Emp(line[0], line[1], line[2].strip())) for row in lstTable: print(row.to_string(), type(row)) # Test IO classes Eio.print_menu_items() Eio.print_current_list_items(lstTable) print(Eio.input_employee_data()) print(Eio.input_menu_options())
# Load data from file into a list of employee objects when script starts EmployeeList = DatabaseProcessor.stringlist_to_employeelist( FileProcessor.read_data_from_file(datafilename)) while True: # Show user a menu of options EmployeeIO.print_menu_items() # Get user's menu option choice userpicked = EmployeeIO.input_menu_options() if userpicked == "1": # Show user current data in the list of employee objects EmployeeIO.print_current_list_items(EmployeeList) elif userpicked == "2": # Let user add data to the list of employee objects EmpObj = EmployeeIO.input_employee_data() EmployeeList.append(EmpObj) elif userpicked == "3": # let user save current data to file DidIWork = FileProcessor.save_data_to_file( datafilename, DatabaseProcessor.employeelist_to_listforcsv(EmployeeList)) if DidIWork: print("Text File saved!\n") else: print("Error saving text file.\n") elif userpicked == "4": # Let user exit program print("Thank you for using my program!") break