Create app coding

Question:


Repl link:

import phonenumbers
from phonenumbers import geocoder

# Step 1: Get the phone number from the user
phone_number = input("Enter the phone number: ")

# Step 2: Parse and validate the phone number
try:
    parsed_number = phonenumbers.parse(phone_number, None)
    if not phonenumbers.is_valid_number(parsed_number):
        print("Invalid phone number!")
        exit()
except phonenumbers.phonenumberutil.NumberParseException as e:
    print("Invalid phone number!")
    exit()

# Step 3: Get the location information for the phone number
region = geocoder.description_for_number(parsed_number, "en")

# Step 4: Display the location information to the user
print("Phone number location:", region)

What’s you’re problem?

2 Likes

Hey @rayhan0167970 welcome to the forums!

Like @element1010 said if you have a problem can you please tell us and if you have one show us your Repl link? If not and you are showing off code you can put this post into the General and/or the Showcase Catergories this shouldn’t be in the Code Help category then. Hope you have a good day :grinning: !

1 Like

I found this error
Parse error: syntax error, unexpected identifier “phonenumbers” in your code on line 1
use this

import phonenumbers

@Darkoknight you would have to use

$ pip install phonenumbers

To make the module work with Python.

sorry thankyou i just noticed