Question: Python: Set animals _ remaining is initialized with three animals read from input. Remove 'cow' from animals _ remaining. Then, assign num _ animals with

Python: Set animals_remaining is initialized with three animals read from input. Remove 'cow' from animals_remaining. Then, assign num_animals with the number of elements in animals_remaining.
Ex: If the input is:
bird
cow
lizard
then the output is:
['bird', 'lizard']
Number of values remaining: 2
Note: Because sets are unordered, the set is printed using the sorted() function here for comparison.
animals_remaining = set()
new_animal1= input()
new_animal2= input()
new_animal3= input()
animals_remaining.add(new_animal1)
animals_remaining.add(new_animal2)
animals_remaining.add(new_animal3)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!