[Tutor] help please

Michael Schmitt mikeschmitt128 at outlook.com
Tue Oct 9 23:20:37 EDT 2018


To whom it may concern:


I am trying to teach myself Python and ran into a problem. This is my code


# name of rivers and country

rivers = {'nile' : 'egypt', 'ohio' : 'US', 'rhine' : 'germany' }

# prints river name
for rivers in rivers.keys():
    print (rivers)

#prints country
for rivers in rivers.values():
    print (rivers)

# prints statement " The (river) is in the country of (country)
for rivers in rivers:
    print ("The " + rivers.keys() + "is in the country of " + rivers.vaules())

I am getting the following error
 for rivers in rivers.values():
AttributeError: 'str' object has no attribute 'values'

Thanks for the help.

Sincerely,

Michael S. Schmitt


[https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif]<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>    Virus-free. www.avast.com<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>


More information about the Tutor mailing list