1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
den301095 [7]
3 years ago
5

Write a program that asks the user to enter an international dialing code and then looks it up in the country_codes array (see S

ec 16.3 in C textbook). If it finds the code, the program should display the name of the corresponding country; if not, the program should print an error message. For demonstration purposes have at least 20 countries in your list.
Computers and Technology
1 answer:
Montano1993 [528]3 years ago
5 0

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")

You might be interested in
Question #4
Igoryamba

Answer:

The y-intercept is going to fall by -2 but the x-intercept will run +5

Explanation:

Becuase the derivative of the equation causes this when plugged into the formula

6 0
3 years ago
Different he launc.<br>in function are available with MS-Excel<br>Many​
Kruka [31]

functions are available with MS-Excel..

1.count and sum

2.cell references

3.data and Time

4.text

5.lookup and reference

6.finanical

7.round

8.array formula

7 0
3 years ago
Which is the following should be selected in the paragraph dialogue box to prevent page break from occurring within a paragraph
Savatey [412]

Answer:

Explanation: keep lines together

6 0
3 years ago
A computer application such as Microsoft Access that is used to store data and convert it into information is a ________________
lorasvet [3.4K]
All data is stored in table
5 0
4 years ago
Td udutdiydiyfyfigciydutdutdtt
luda_lava [24]

hghsFHSkuhsdggewyewGUKweutgqeYFGYhgsukGFwufYHFUKyfukyfeukfrgkufwrGwukfrgtuskgtweYRtueoytewiuWYI7W

5 0
3 years ago
Read 2 more answers
Other questions:
  • A short-circuit evaluation is where each part of an expression is evaluated only as far as necessary to determine whether the en
    14·1 answer
  • If you're able to understand directions more easily when you hear them instead of reading them you are most likely
    12·1 answer
  • M f2.app.edmentum.com
    5·1 answer
  • How do computers read zeroes and ones?
    7·1 answer
  • Sequence encryption is a series of encryptions and decryptions between a number of systems, wherein each system in a network dec
    9·1 answer
  • I need to know what is share market plssss
    8·2 answers
  • Why should you avoid the use of sarcasm, clichés, and idioms in business letters?
    11·2 answers
  • …….. and ……...are called binary digits. (Computer Science)
    13·2 answers
  • Which of the following could be part of an algorithm?
    11·1 answer
  • Int r=6;<br> int v=20;<br> System.out.println( r % v );
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!