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
  • mammals.txt squirrel,2,0.5,Herbivore,Sciurus griseus kangaroo,7,90,Herbivore,Macropus rufus gorilla,20,150,Herbivore,Gorilla beringei sea lion,12,250,Carnivore,Zalophus californianus guinea pig,4,3,Herbivore,Cavia porcellus whale (grey),70,36000,Herbivor

    mammals.txt squirrel,2,0.5,Herbivore,Sciurus griseus kangaroo,7,90,Herbivore,Macropus rufus gorilla,20,150,Herbivore,Gorilla beringei sea lion,12,250,Carnivore,Zalophus californianus guinea pig,4,3,Herbivore,Cavia porcellus whale (grey),70,36000,Herbivore,Eschrichtius robustus cat,12,4,Carnivore,Felis catus sheep,12,180,Herbivore,Ovis aries giraffe,10,1000,Herbivore,Giraffa mouse,3,0.04,Omnivore,Mus musculus puma,12,50,Carnivore,Puma concolor orca,50,4000,Carnivore,Orcinus orca beaver,5,20,Herbivore,Castor canadensis fox,7,6,Omnivore,Vulpes vulpes donkey,12,300,Herbivore,Equus asinus buffalo,15,650,Herbivore,Bison bison cow,15,700,Herbivore,Bos taurus baboon,20,40,Omnivore,Papio ursinus horse,20,500,Herbivore,Equus ferus caballus moose,12,450,Herbivore,Alces alces goat,9,90,Herbivore,Capra aegagrus hircus chimpanzee,20,45,Omnivore,Pan troglodytes bear (grizzly),25,270,Omnivore,Ursus arctos leopard,12,55,Carnivore,Panthera pardus camel,40,500,Herbivore,Camelus dromedarius rhinoceros,40,2000,Herbivore,Ceratotherium simum simum hippopotamus,25,1400,Herbivore,Hippopotamus amphibius opposum,1,4,Omnivore,Didelphis virginiana howler monkey,15,7,Herbivore,Alouatta palliata deer,8,55,Herbivore,Odocoileus virginianus elephant,65,4500,Herbivore,Elephas maximus dog,12,25,Carnivore,Canis lupus familiaris bat,15,1,Omnivore,Pteropus vampyrus wolf,5,40,Carnivore,Canis lupus zebra,15,300,Herbivore,Equus quagga elk,15,280,Herbivore,Cervus...

  • 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....

  • 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...

  • 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...

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
ADVERTISEMENT