Posts

Showing posts from March 27, 2019

loop back to a menu when using a return statement?

Image
0 I am adding up all the values in a text file and using a return statement to display the value at the end, I am also using that value in another function. So basically I have a function that calls another function. My problem is that I need to ask the user if they want to go back to the menu again but I can't do that when using a return statement but if I don't use a return statement then I can get the total to go into my other function. The average_salary function is the one that calls the total_salary function so that it can get the total value. My code : with open("Records.txt") as file: # Opens the text file with all the records in it records = [line.strip() for line in file if not line.startswith("#")] # Creates a list named Records and stores all the records ignori