Question: Is there anyone here that can chat with me about my problem? I will pay for some help! 3.12 LAB: Phone number breakdown Given an

Is there anyone here that can chat with me about my problem? I will pay for some help!

3.12 LAB: Phone number breakdown

Given an integer representing a 10-digit phone number, output the area code, prefix, and line number using the format (800) 555-1212.

Ex: If the input is:

8005551212

the output is:

(800) 555-1212

Hint: Use % to get the desired rightmost digits. Ex: The rightmost 2 digits of 572 is gotten by 572 % 100, which is 72.

Hint: Use // to shift right by the desired amount. Ex: Shifting 572 right by 2 digits is done by 572 // 100, which yields 5. (Recall integer division discards the fraction).

For simplicity, assume any part starts with a non-zero digit. So 0119998888 is not allowed.

302658.1687086

LAB ACTIVITY

3.12.1: LAB: Phone number breakdown

5 / 10

main.py

Load default template...

1

2

3

4

5

6

7

8

9

10

phone_number = int((8005551212))

line_number = phone_number % 10000

area_code_prefix = phone_number // 10000

area_code = area_code_prefix // 1000

prefix = area_code_prefix % 1000

print('(',area_code,')',' ',prefix,'-',line_number, sep='')

Develop modeSubmit mode

When done developing your program, press the Submit for grading button below. This will submit your program for auto-grading.

Submit for grading

Signature of your workWhat is this?

1/28..R--------------------------------------------------------------------------------|0---|5--F-----|5..1/29

Latest submission - 5:12 PM on 01/29/21

Total score: 5 / 10

Only show failing tests

Download this submission

1: Compare outputkeyboard_arrow_up

5 / 5

Input

8005551212

Your output

(800) 555-1212

2: Compare outputkeyboard_arrow_up

0 / 5

Output differs. See highlights below.

Input

9995551111

Your output

(800) 555-1212

Expected output

(999) 555-1111

Anonymous answered this answered this question with:

phone_number = int(input()) # We need to read input instead of hard-coding the phone number

What does this mean? I ran the code without hard coding the number and I get this:

Traceback (most recent call last):

File "main.py", line 1, in

phone_number = int(input())

EOFError: EOF when reading a line

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!