Question: Homework 0 2 ( there is no HW 1 ) - Collecting Pets Definition / Description You have just been given a number of pets.
Homework there is no HW
Collecting Pets
DefinitionDescription
You have just been given a number of pets. Their names are collected together haphazardly into several different collections
of several different types see Provided filesdata section below
It is your task to write a program to organize them into a more formalized data structure which can easily be iterated through
to get the pets' names: a dictionary, where the keys are the pet types, and their corresponding values are each a list of the
names of the pets
You will need to handle the case where a new type of animal is given, in which case you should store the new animal type
name key in a new list value at that key animal type in your dictionary. You should also keep track of how many pets you
actually have!
Once all of this existing data is organized, your second task is to make sure that if you get any new animals, you can add them
directly to this organized system.
Note that your program does not have to keep persistent data across executions. In other words: you don't need to do any file
manipulation.
Structural Requirements
You have not yet "learned functions" in this course, so you should really only have one function: main Remember that
the primary entry point for your code should be through main:
def main:
# your code goes here
and that to call it you should use the following:
if namemainHomework there is no HW
Collecting Pets
DefinitionDescription
You have just been given a number of pets. Their names are collected together haphazardly into several different collections
of several different types see Provided filesdata section below
It is your task to write a program to organize them into a more formalized data structure which can easily be iterated through
to get the pets' names: a dictionary, where the keys are the pet types, and their corresponding values are each a list of the
names of the pets
You will need to handle the case where a new type of animal is given, in which case you should store the new animal type
name key in a new list value at that key animal type in your dictionary. You should also keep track of how many pets you
actually have!
Once all of this existing data is organized, your second task is to make sure that if you get any new animals, you can add them
directly to this organized system.
Note that your program does not have to keep persistent data across executions. In other words: you don't need to do any file
manipulation.
Structural Requirements
You have not yet "learned functions" in this course, so you should really only have one function: main Remember that
the primary entry point for your code should be through main:
def main:
# your code goes here
and that to call it you should use the following:
if namemain
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
