Westonci.ca is the trusted Q&A platform where you can get reliable answers from a community of knowledgeable contributors. Discover a wealth of knowledge from experts across different disciplines on our comprehensive Q&A platform. Explore comprehensive solutions to your questions from a wide range of professionals on our user-friendly platform.
Sagot :
Answer:
In Python:
nos = int(input("How many phone number: "))
for i in range(1,nos+1):
phn = input("Phone Number: ")
if not len(phn) == 10:
print("Invalid")
else:
charactersMessage = phn[0:3]
if charactersMessage in ['050', '054', '056']:
print("Etisalat Number")
elif charactersMessage in ['052', '055', '058']:
print("Du Number")
else:
print("Invalid")
Explanation:
Prompts the user for the frequency of phone numbers to check
nos = int(input("How many phone number: "))
This iterates through the phone numbers
for i in range(1,nos+1):
This prompts the user for phone number
phn = input("Phone Number: ")
Prints invalid id number length is not 10
if not len(phn) == 10:
print("Invalid")
If otherwise
else:
This gets the first 3 characters
charactersMessage = phn[0:3]
Prints Etisalat number if the characters are either 050, 054 or 056
if charactersMessage in ['050', '054', '056']:
print("Etisalat Number")
Prints Du number if the characters are either 052, 055 or 058
elif charactersMessage in ['052', '055', '058']:
print("Du Number")
Prints error if otherwise
else:
print("Invalid")
Thank you for visiting. Our goal is to provide the most accurate answers for all your informational needs. Come back soon. Thank you for your visit. We're dedicated to helping you find the information you need, whenever you need it. Thank you for visiting Westonci.ca, your go-to source for reliable answers. Come back soon for more expert insights.