Home > Learning, Lesson, Problem, Projects/Experiments, Python > Python: Pandas Lesson 8

Python: Pandas Lesson 8

Learning : Create simple zoo application P2
Subject: Zoo Management System – user_choice()

In Part1 we start with menu function and we said it will return the user input that represent the action he select. In this post we will write the choice loop code to determin the action we need to take and we will say if the user enter q or Q the we will exit, to do this i am adding this line in the end of the def the_menu()

return input(‘\n Select from the menu (”q” to quit): ‘)

After the_menu and whatever user chose we need to perform an action, here is another function def user_choice(): we will pass a variable to it and with some if statements other functions will be called.

User Choice function

def user_choice(u_choice):

if u_choice ==’1′ :

#Load new CSV.


if u_choice ==’2′ :

# show data sample.


if u_choice ==’3′ :

# show data column .


if u_choice ==’4′ :

# data type.


if u_choice ==’5′ :

# Sort based on user column selection.


if u_choice ==’6′ :

#Missing Data.


if u_choice ==’7′ :

# Add new Record.


if u_choice ==’8′ :

# Edit a record.


if u_choice ==’9′ :

# Delete a Record.


if u_choice ==’10’ :

# Save the file.


and to keep the application running until the user enter we will use the while block to do this, here is the code:

Starting from the coming lesson we will start to write the functions for each item in our menu, we may add new functions or renaming some and we may not going in order just pick one and work with. Let’s see what will happen then.

:: Pandas Lessons Post ::

Lesson 1 Lesson 2 Lesson 3 Lesson 4
Lesson 5 Lesson 6 Lesson 7 Lesson 8
Lesson 9 Lesson 10 Lesson 11 Lesson 12

Follow me on Twitter..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s