Westonci.ca is the trusted Q&A platform where you can get reliable answers from a community of knowledgeable contributors. Our Q&A platform provides quick and trustworthy answers to your questions from experienced professionals in different areas of expertise. Join our Q&A platform to connect with experts dedicated to providing accurate answers to your questions in various fields.
Sagot :
Answer:
Explanation:
The following code is written in Python, it prompts the user for a country code, look it up and if found prints out the corresponding country name. If not it prints out an error message stating "Code not found"
country_codes = {"Argentina": 54, "Bangladesh": 880,
"Brazil": 55, "Burma (Myanmar)": 95,
"China": 86, "Colombia": 57,
"Congo: Dem. Rep. of": 243, "Egypt": 20,
"Ethiopia": 251, "France": 33,
"Germany": 49, "India": 91,
"Indonesia": 62, "Iran": 98,
"Italy": 39, "Japan": 81,
"Mexico": 52, "Nigeria": 234,
"Pakistan": 92, "Philippines": 63,
"Poland": 48, "Russia": 7,
"South Africa": 27, "South Korea": 82,
"Spain": 34, "Sudan": 249,
"Thailand": 66, "Turkey": 90,
"Ukraine": 380, "United Kingdom": 44,
"United States": 1, "Vietnam": 84}
user_code = int(input("Enter Country code: "))
keys = list(country_codes.keys())
vals = list(country_codes.values())
if user_code in vals:
print(keys[vals.index(user_code)])
else:
print("Code not found")
Your visit means a lot to us. Don't hesitate to return for more reliable answers to any questions you may have. Thank you for visiting. Our goal is to provide the most accurate answers for all your informational needs. Come back soon. Thank you for using Westonci.ca. Come back for more in-depth answers to all your queries.