top of page
learn_data_science.jpg

Data Scientist Program

 

Free Online Data Science Training for Complete Beginners.
 


No prior coding knowledge required!

Writer's pictureLucien Dikla Ngueleo

Telephone code App zone 6 (oceanic)

Generality

An international dialing code is a telephone prefix used in the telephone numbers of countries or regions that are members of the International Telecommunication Union. The area code indicates the country where the owner of the number is located


def phone_code_ocean(county):
  dic_code_ocean = {
    "Australia" :"61",
    "Fiji" :"679",
    "Marianas" :"1-670",
    "Niue" :"683",
    "New Caledonia": "687",
    "New Zealand" :"64",
    "Papua New Guinea" :"675",
    "French Polynesia" :"689",
    "Solomon Islands": "677"}
 return dic_code_ocean.get(county, "country not found")

Example of use

print(phone_code_ocean("Australia"))

out

 61

Example of use

print(phone_code_ocean("cameroon"))

out

country not found

important concepts in python

A dictionary in python is a kind of list but instead of using indexes, we use alphanumeric keys.

The get() method allows you to retrieve a value from a dictionary and if the key is not found you can give a value to return by default country not found

0 comments

Recent Posts

See All

Kommentare


bottom of page