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.




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 use the return command 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 located here (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 found here (Links to an external site.). This assignment includes material through Python Lesson 5 located here. https://en.wikibooks.org/wiki/A_Beginner%27s_Python_Tutorial/Functions https://docs.python.org/3.7/library/functions.html https://en.wikibooks.org/wiki/A_Beginner%27s_Python_Tutorial
Answered 6 days AfterJan 31, 2021

Answer To: Create a Python 3 script file that creates a function that returns the prefix of a user inputted 10...

Sudipta answered on Feb 06 2021
147 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