On Wed, Oct 10, 2018, 12:37 PM 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) > Why are you using "for rivers in rivers". Replace this for loop with :- for river in rivers: print ("The " + river + "is in the country of " + rivers.get(river)) 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