You are using the same variable name twice.
You may use "rivers" for the dict and "river" for values.
Also use descriptive names for variables. For eg if you correct the above
mistake, the next one will be this line

for rivers in rivers.values():
    print (rivers)


and sorry for top positing.


On Wed 10 Oct, 2018, 12:38 Michael Schmitt, <mikeschmitt...@outlook.com>
wrote:

> 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
> >
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to