answer.
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
larisa86 [58]
2 years ago
4

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.
Computers and Technology
2 answers:
ankoles [38]2 years ago
5 0

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

The examples and taken into account and the code is written.

The code for the above statement is given below :

Explanation:

phone_number = input()

if (len(phone_number)==10):

print(phone_number[0] + phone_number[1] + phone_number[2] + '-' + phone_number[3] + phone_number[4] + phone_number[ 5] + '-' + phone_number[6] + phone_number[7] + phone_number[8] + phone_number[9])

else:

print('invalid phone number')

The number is taken as the input. Then, the length is checked.

If the number starts with 0 it is not allowed.

andrey2020 [161]2 years ago
5 0

Answer:

input: 8005551212

phone_number = int(input())

area_code = phone_number // 10000000

prefix = (phone_number // 10000) % 1000

line_number = phone_number % 10000

print(f'({area_code}) {prefix}-{line_number}')

Explanation:

#input data

8005551212

#define phone number to input data

phone_number = int(input())

#logic to find area_code, prefix, and line_number

area_code = phone_number // 10000000

prefix = (phone_number // 10000) % 1000

line_number = phone_number % 10000

#f-strings(format strings) are a shorter way of doing str.format() calls.

print(f'({area_code}) {prefix}-{line_number}')

You might be interested in
Wendy is an attacker who recently gained access to a vulnerable web server running Microsoft Windows. What command can she use t
VikaD [51]

Answer:

I would say that if she is connected to the server and has grained access to the server, Wendy would have to use the command shortkey win+r (to run) or she could just use the "Type here to search" function.

Then you can type the words "cmd" to bring up the command prompt

Lastly, she would need to use the protocol scp to transfer files. Wendy might need to include a destination for the files to be directed to.

7 0
2 years ago
Modern operating systems decouple a process address space from the machine’s physical memory. List two advantages of this design
kolbaska11 [484]

Answer: Decoupling action of the process address space refers to the physical memory of the device getting decoupled to provide  address translation in automatic way. The benefit of this method is as follows:-

  • Faster starting up of the program
  • The physical address space gets managed on its own
  • Helps in execution of large program when the main memory of the machine is of  smaller size in comparison with program

7 0
2 years ago
An aviation tracking system maintains flight records for equipment and personnel. The system is a critical command and control s
sergeinik [125]

Answer:

offline backup solution

Explanation:

In such a scenario, the best option would be an offline backup solution. This is basically a local and offline server that holds all of the flight record data that the cloud platform has. This offline backup server would be updated frequently so that the data is always up to date. These servers would be owned by the aviation company and would be a secondary solution for the company in case that the cloud platform fails or the company cannot connect to the cloud service for whatever reason. Being offline allows the company to access the database regardless of internet connectivity.

5 0
2 years ago
As in algebra, you can use brackets to override the order of operations Excel follows to perform formula calculations. True or f
sertanlavr [38]

Answer:

false

Explanation:

parasynthesis is used to change the order of priority.

6 0
2 years ago
A workgroup database is a(n) _____ database
Step2247 [10]
It is a shared database
8 0
2 years ago
Other questions:
  • Shaniya has misspelled a scientific name in her biology report. She needs to correct it, but she has no access to a computer. Sh
    13·2 answers
  • A school librarian has been asked to identify inappropriate Internet usage. Which students would most likely be reported to the
    5·2 answers
  • What is computer? Explain the characteristics of computer.<br>​
    12·1 answer
  • In the game of $Mindmaster$, secret codes are created by placing pegs of any of seven different colors into four slots. Colors m
    5·1 answer
  • Alyosha was explaining to a friend the importance of protecting a cryptographic key from cryptoanalysis. He said that the key sh
    10·1 answer
  • Discuss the importance of following a well-integrated change control process on IT projects. What consequences can result from n
    14·1 answer
  • Consider the following 3-PARTITION problem. Given integers a1; : : : ; an, we want to determine whether it is possible to partit
    10·1 answer
  • Omar wants to add transitions to his presentation, so he clicks the Transitions tab. Which tasks can he now complete? Check all
    10·1 answer
  • Alice just wrote a new app using Python. She tested her code and noticed some of her lines of code are out of order. Which princ
    8·1 answer
  • What are the two atomic operations permissible on semaphores?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!