Question: Program 1 : phone.py For the first program in today's lab, you will need to write a program that formats a given phone number as

Program 1:
phone.py
For the first program in today's lab, you will need to write a program that formats a given phone number as input. Given an integer representing a 10-digit phone number, output the area code, prefix, and line number using the format (800)555-1212.
If the input is:
8005551212
The output in the terminal should be:
(800)555-1212
For simplicity, assume any part starts with a non-zero digit. So,0119998888 is not allowed.
Example Terminal Output:
Please enter your phone number: 5551845433
Phone Number: (555)184-5433
Hints
Use % to get the desired rightmost digits.
a. Ex: The rightmost 2 digits of 572 is gotten by 572%100, which is 72.
Use // to shift right by the desired amount.
a. Ex: Shifting 572 right by 2 digits is done by 572??100, which yields 5.(Recall integer division discards the fraction).
Skills Covered
Using the modulo and floor division operators
Deliverables
For this program you will need to provide the python file containing your code as well as a screenshot of the output of your program. Please name your files as follows:
Python Files
lastname_firstname_filename.py
For example: hawamdeh_faris_phone.py
Screenshots
lastname_firstname_filename.png
For example: hawamdeh_faris_phone.png
 Program 1: phone.py For the first program in today's lab, you

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!