Home > other >  Python is a issue of dictionary use
Python is a issue of dictionary use

Time:10-01

 
Def city_country () :
Guide={' Santiago ':' Chile ', 'according to' : 'China' and 'Beijing' : 'China'}
City_name=input (" City name: ")
If city_name in guide. The keys () :
City_and_country=city_name + "+ STR (guide. Get (' city_name))
The else:
='unkown city_and_country city'
Return city_and_country
Print (city_country ())



The hope can help solve the problem of the following output thank
City name: according to
According to None
This is my output

CodePudding user response:

Guide. The get (' city_name ')
Look at your quotes

CodePudding user response:

1/f, reference and 蘤 old crepe response:
guide. Get (' city_name)
Take a look at your quotes
is behind the has been None, not China

CodePudding user response:

refer to the second floor weixin_42820699 response:
Quote: refer to 1st floor and 蘤 old crepe reply:
guide. Get (' city_name)
Take a look at your quotes
is behind the has been None, rather than China


Can't see you, more than a single quotes, you this is a string is not a variable

CodePudding user response:

references and 蘤 old crepe reply: 3/f
Quote: refer to the second floor weixin_42820699 response:

Quote: 1/f, reference and 蘤 old crepe reply:
guide. Get (' city_name)
Take a look at your quotes
is behind the has been None, rather than China


Can't see you, more than a single quotes, you this is a string is not a variable
ahhh thank you saw it
  • Related