1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Strike441 [17]
4 years ago
10

Given a long 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 des

Computers and Technology
1 answer:
kaheart [24]4 years ago
4 0

Answer:

# User is prompted to enter phone number

phone_number = int(input("Enter your 10-digit phone number: "))

# this modulus operation will give the last 4 digit

# as the line number

line_number = phone_number % 10000

# this integer division will give a combination

# of area code and prefix

area_code_prefix = phone_number // 10000

# this integer division of the area_code_prefix

# will give the area_code

area_code = area_code_prefix // 1000

# this modulo operation of the area_code_prefix

# will give the prefix

prefix = area_code_prefix % 1000

# the phone number is printed in the specified format

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

Explanation:

A sample image of program output is attached.

You might be interested in
Short Essay on the history of Computer​
Ann [662]
Go on a essay website the right a essay about a topic !
5 0
3 years ago
Read 2 more answers
Which THREE devices can perform both input and output operations?
Andru [333]

Answer:

nic card,speakers,router

4 0
4 years ago
Read 2 more answers
______ is used to extract knowledge from sources of data-NoSQL databases, Hadoop data stores, and data warehouses-to provide dec
Alex777 [14]

Answer: Data analytics

Explanation:

3 0
3 years ago
A(n) _____ is used to create a new file or to overwrite an existing file by attaching it to a command that produces output.
Alex787 [66]

Answer: Redirection symbol

Explanation: Redirection symbol/operator is the special operator that is used in programs along with commands. The operators that are generally used are ">",">>","I" and "<". These commands are given in the section of the DOS commands and other command prompt sections. This is the process where the changes in input feed and output is  analyzed and read through these commands.

3 0
3 years ago
Why computer known as tool of information​
S_A_V [24]

Answer:

because it has the ability to capture the whole information you need or downloaded

8 0
3 years ago
Other questions:
  • Create a class that represents an employee. This class will have three constructors to initialize variables. If the constructor
    9·1 answer
  • Define a function CoordTransform() that transforms the function's first two input parameters xVal and yVal into two output param
    12·1 answer
  • When a defendant pleads guilty to one offense just to have another offense dropped, this is what type of plea bargain
    12·2 answers
  • Write a program that gets a single character from the user. If the character is not a capital letter (between 'A' and 'Z'), then
    15·1 answer
  • Why is it essential to know what information will be needed from the database from the outset of development?
    9·1 answer
  • Write a for loop to print all elements in courseGrades, following each element with a space (including the last). Print forwards
    10·1 answer
  • Describe how being a global citizen in the world of advanced technology can be beneficial to your success in meeting your person
    13·1 answer
  • Buying the newest phone as soon as it is released when your current phone works perfectly is not a good idea for all but which o
    10·2 answers
  • How to create a trace table
    10·1 answer
  • What is a thread? what resources does it share with other threads in the same process?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!