Question

Python please For this program, we will be making lists for the local Zoo. You have...

Python please

For this program, we will be making lists for the local Zoo. You have been provided with 4 lists of data already created for you. Using this data, we update the data at this Zoo. YOU MUST USE LIST FUNCTIONS FOR REMOVING TO RECEIVE YOUR FULL POINTS!

Input:

  • A type of animal -- This information should be provided in response the question: "What animal are we removing?"
  • A number corresponding to the selection of a menu number (see menu below) 1) Do not remove animal from social list 2) Only remove animal from social list 3) Remove from all lists animal appears in

Output:

  • If user selected "1":
  • Remove the animal from any non-social list the animal appears in.
  • Display all lists in the order: Carnivore, Herbivore, Omnivore, Social
  • If user selected "2":
  • Remove the animal from the social list if the animal is in that list.
  • Display all lists in the order: Carnivore, Herbivore, Omnivore, Social
  • If user selected "3":
  • Remove the animal from any list the animal appears in.
  • Display all lists in the order: Carnivore, Herbivore, Omnivore, Social
  • If user makes an invalid select, print the message That was not an option

HINT: Remember, lists are ordered, so DO NOT sort your output!

LAB

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Python code:

Herbivore = ['Rabbit','Dog','Cat']
Carnivore = ['Lion','Dog','Cat','Cheetah']
Omnivore = ['Dog','Cat','Monkey']
Social = ['Monkey','Dog','Horse']
print("Initial lists:")
print(Herbivore)
print(Carnivore)
print(Omnivore)
print(Social)
print("---------------------------------------------------")
animal = input("What animal are we removing?")
print("MENU:")
print("1) Do not remove animal from social list ")
print("2) Only remove animal from social list")
print("3) Remove from all lists animal appears in all")
option = int(input("Enter an option : "))

if(option == 1):
if(animal in Herbivore):
Herbivore.remove(animal)
if(animal in Carnivore):
Carnivore.remove(animal)
if(animal in Omnivore):
Omnivore.remove(animal)
print("Removing animal from non Social lists")
print("Displaying lists:")
print(Herbivore)
print(Carnivore)
print(Omnivore)
print(Social)
elif(option == 2):
if(animal in Social):
Social.remove(animal)
print("Removing animal from Social lists")
print("Displaying lists:")
print(Herbivore)
print(Carnivore)
print(Omnivore)
print(Social)
elif(option == 3):
if(animal in Herbivore):
Herbivore.remove(animal)
if(animal in Carnivore):
Carnivore.remove(animal)
if(animal in Omnivore):
Omnivore.remove(animal)
if(animal in Social):
Social.remove(animal)
print("Removing animal from all lists")
print("Displaying lists:")
print(Herbivore)
print(Carnivore)
print(Omnivore)
print(Social)
else:
print("That was not an option")
  
Execution screenshots:

Note:Please like the answer.Thank you.Have a nice day.


  

Add a comment
Know the answer?
Add Answer to:
Python please For this program, we will be making lists for the local Zoo. You have...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please help me with the following question. This is for Java programming. In this assignment you...

    Please help me with the following question. This is for Java programming. In this assignment you are going to demonstrate the uses of inheritance and polymorphism. You will create an Animals class and a Zoo class that holds all the animals. You should create a general Animalclass where all other classes are derived from (except for the Zoo class). You should then create general classes such as Mammal, Reptile, and whatever else you choose based off of the Animalclass. For...

  • Please help me with the following question. This is for Java programming. In this assignment you are going to demonstrate the uses of inheritance and polymorphism. You will create an Animals class and...

    Please help me with the following question. This is for Java programming. In this assignment you are going to demonstrate the uses of inheritance and polymorphism. You will create an Animals class and a Zoo class that holds all the animals. You should create a general Animalclass where all other classes are derived from (except for the Zoo class). You should then create general classes such as Mammal, Reptile, and whatever else you choose based off of the Animalclass. For...

  • Use Python 3 Create a program that uses Turtle to draw shapes. Show the following menu:...

    Use Python 3 Create a program that uses Turtle to draw shapes. Show the following menu: Enter Circle Enter Rectangle Remove Shape Draw Shapes Exit Circles – User inputs position, radius, and color. The position is the CENTER of the circle Rectangles – User inputs position, height, width, color. The position is the lower left-hand corner Colors – Allow red, yellow, blue, and green only Remove – Show the number of items in the list and let the user enter...

  • please help in python Suppose you have been tasked to write a Python program that will...

    please help in python Suppose you have been tasked to write a Python program that will accomplish the following tasks as related to the daily gas prices for the past year (365 days): • display the five (5) lowest gas prices for the year • display the five (5) highest gas prices for the year • allow the user to search for a specific gas price in the list; you should display a message for whether or not you found...

  • python language Problem Description: In this program we are going to explore a list or an...

    python language Problem Description: In this program we are going to explore a list or an array of integers using Python. Your program should read a set of integers from the user and store them in a list. Read numbers from the user until the user enters 0 to quit. Then store them in a list. Your program should them compute the sum of all the numbers in the list and output to the user. You will use lists and...

  • Use python to code! Q1 - You need to keep track of book titles. Write code...

    Use python to code! Q1 - You need to keep track of book titles. Write code using function(s) that will allow the user to do the following. 1. Add book titles to the list. 2. Delete book titles anywhere in the list by value. 3. Delete a book by position. Note: if you wish to display the booklist as a vertical number booklist , that is ok (that is also a hint) 4. Insert book titles anywhere in the list....

  • 23.4 Project 4: Using Pandas for data analysis and practice with error handling Python Please! 23.4...

    23.4 Project 4: Using Pandas for data analysis and practice with error handling Python Please! 23.4 PROJECT 4: Using Pandas for data analysis and practice with error handling Overview In this project, you will use the Pandas module to analyze some data about some 20th century car models, country of origin, miles per gallon, model year, etc. Provided Input Files An input file with nearly 200 rows of data about automobiles. The input file has the following format (the same...

  • A specific question I have on this project is how do I make the stars all...

    A specific question I have on this project is how do I make the stars all align into making a box. Whenever I post this question the stars on the right edge go in towards the item of the shopping list. I need the starts to create a a box around the shopping items. Instructions: Using Python write a program that allows a user to create and use a shopping list. Your program will display a menu of options to...

  • Using Java In this assignment we are working with arrays. You have to ask the user...

    Using Java In this assignment we are working with arrays. You have to ask the user to enter the size of the integer array to be declared and then initialize this array randomly. Then use a menu to select from the following Modify the elements of the array. At any point in the program, if you select this option you are modifying the elements of the array randomly. Print the items in the array, one to a line with their...

  • IN PYTHON Develop the program that will allow you to obtain an ordered list of whole...

    IN PYTHON Develop the program that will allow you to obtain an ordered list of whole numbers from least to greatest from two lists of whole numbers. The individual values ​​of the input lists are captured by the user one by one and then both lists will be joined and then sorted in ascending order (from lowest to highest value). Your program should allow the capture of the entire values ​​of the lists without making use of messages (legends) to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT