Question Fill in the blanks to complete the “endangered_animals” function. This function accepts a dictionary containing a list of endangered animals (keys) and their remaining population (values).  For each key in the given “animal_dict” dictionary, format a string to print the name of the animal, with one animal name per line.     def endangered_animals(animal_dict):     result = ""     # Complete the for loop to iterate through the key and value items      # in the dictionary.         for ___          # Use a string method to format the required string.         result += ___      return result   print(endangered_animals({"Javan Rhinoceros":60, "Vaquita":10, "Mountain Gorilla":200, "Tiger":500}))   # Should print: # Javan Rhinoceros # Vaquita # Mountain Gorilla # Tiger

PNAGSA The Asker · Computer Science

Fill in the blanks to complete the “endangered_animals” function. This function accepts a dictionary containing a list of endangered animals (keys) and their remaining population (values).  For each key in the given “animal_dict” dictionary, format a string to print the name of the animal, with one animal name per line.

 

 

def endangered_animals(animal_dict):

    result = ""

    # Complete the for loop to iterate through the key and value items 

    # in the dictionary.    

    for ___ 

        # Use a string method to format the required string.

        result += ___ 

    return result


 

print(endangered_animals({"Javan Rhinoceros":60, "Vaquita":10, "Mountain Gorilla":200, "Tiger":500}))

 

# Should print:

# Javan Rhinoceros

# Vaquita

# Mountain Gorilla

# Tiger

More
Community Answer
05PTKE

【General guidance】The answer provided below has been developed in a clear step by step manner.Step1/1def endangered_animals(animal_dict):result = ""# Complete the for loop to iterate through the key and value items# in the dictionary. for animal, population in animal_dict.items(): # Use a string method to format the required string. result += animal + "\n"return resultprint(endangered_animals({"Javan Rhinoceros":60, "Vaquita":10, "Mountain Gorilla":200, "Tiger":500})) Should print:Javan RhinocerosVaquitaMountain GorillaTigerExplanation:The "endangered_a ... See the full answer