Python : Expenditure App
Expenditure Application
User input ‘choice’:
In today post we will add the user input to our menu and based on the user input the app some function will run. As we said in the previous post ‘The Menu‘ we will use (9) to Exit from the application.
To read the user input we will use ‘input(‘something’)’ statement and The Menu def will return the choice back so our if statement will take us to another function, or EXIT if choice = 9, so let’s start.
As we can see in the last two lines of the_menu def, we have
choice = input(‘What you want to do? ‘) and return choice
Then in the main application body we will have while statement holding if statement as here:
choice = the_menu() # Here we are calling the menu and putting the return in the choice.
while choice != ‘9’ :
if choice == ‘1’:
# Calling “Add New Entry” function
choice = the_menu()
if choice == ‘2’:
# Calling “Delete an Entry” function
choice = the_menu()
if choice == ‘3’:
# Calling “Change an Entry” function
choice = the_menu()
if choice == ‘4’:
# Calling “Show Total Expenditure in a Year.” function
choice = the_menu()
if choice == ‘5’:
# Calling “Show Expenditure Details in a year.” function
choice = the_menu()
if choice == ‘9’:
choice = the_menu()
brack
Your code should be something like what we have in the image.
-
December 2, 2018 at 11:00 amPython : Expenditure App | Ali's Photography Space...
-
December 4, 2018 at 10:52 amPython : Expenditure App | Ali's Photography Space...