View the step-by-step solution to:

python def save_earth(file, animal_dict): ''' This function will read from a file and populate the empty dictionary passed in as a parameter.

python

def save_earth(file, animal_dict):

  '''

  This function will read from a file and populate the empty dictionary passed in as a parameter.

   

  The file contains information of animals found on Earth. The file contains two names on 

  each line. The first name is either an animal type or deadly bacteria/virus. The second name

  is a name for the animal type, , or virus. Animal types include Bird, Fish, Mammal,

  and Reptile.

   

  Your task is to save all the creatures (animal types) listed in the file from the evil

  bacteria and viruses that randomly roam the file. You are to map only animal types to their 

  corresponding names. If you come across a bacteria or a virus do not place it in the animal_dict.

   

  Example:

    animal_dict{

      "Bird" : ["Humming Bird", "Crow", "Dove" ...]

      ...

    }

     

  Parameters: file - name of the file to be read

        animal_dict - empty dictionary that will eventually map animal types to a list of animal names.

         

  Returns: None 

  ''' 

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question