Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Create a Python 3 script file that creates a function that returns the prefix of a user inputted 10 digit phone number. No need to write checks if user is inputting the correct characters. You must...

1 answer below »

Create a Python 3 script file that creates afunctionthat returns theprefixof a user inputted 10 digit phone number. No need to write checks if user is inputting the correct characters. You must use thereturncommand in your function when returning the prefix value. The user should be asked for a phone number and then your function should automatically be called to display the prefix.

HINT: Phone numbers have this format: (Area Code) - (Prefix) - (line #)

Make sure to understand all of Python Lesson #4 locatedhere(Links to an external site.).

Rules for Python assignment submissions:

Submit your code as a .py file.

Your first line of code MUST be a comment with your name and the date.

You may ONLY use the functions listed in this or past assignments.

Information for any function we use can be foundhere(Links to an external site.).

This assignment includes material through Python Lesson 5 locatedhere.

Answered 6 days After Jan 31, 2021

Solution

Sudipta answered on Feb 06 2021
150 Votes
#*****************************************
# Name: GEORGE HARVEY DATE: 06-02-2021
#*****************************************
def prefix(phone):
len0=len(phone)
l=phone.split('-')
ans=l[1]
if len(ans)==3:
return(int(ans))
num=input("Enter Phone number(Format:(Area...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here