 # Question & Answer: Write a pseudocode for a python program that prompts (requests) a user to enter 10 digit phone number. The program will ch…..

Write a pseudocode for a python program that prompts (requests) a user to enter 10 digit phone number. The program will check if the user enters 10 digits or not. If the user enters less than or more than 10 digit number, the program would display that the number of digits is not correct (wrong entry). If the user enters exactly 10 digit number, the program should print out the phone number in the following format (651)703-4879)

Don't use plagiarized sources. Get Your Custom Essay on
Question & Answer: Write a pseudocode for a python program that prompts (requests) a user to enter 10 digit phone number. The program will ch…..
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS \$13/PAGE

pseudocode:
x = input number (Input it as string)
count number of digits
if count is not equal to 10
print ‘Wrong Entry”
else
str = “(”
for i: 0 to 9:
if i == 3 :
str = str + “)” + x[i]
else
if (i == 6)
str = str + “-” + x[i]
else
str = str + x[i]

print(str)

Actual Code is as follows:

#!usr/bin/python

x = input(‘Enter phone number:’)
if len(x) != 10 :
print(‘Wrong entry’)
else:
str = “(”
for i in range(10):
if i == 3:
str = str + “)” + x[i]
else:
if i== 6 :
str = str + “-” + x[i]
else:
str = str + x[i]
print(str)