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