subject
Computers and Technology, 08.03.2021 19:20 lin550

Given an integer representing a 10-digit phone number, output the area code, prefix, and line number, separated by hyphens. 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 are 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 that integer division discards the fraction).
For simplicity, assume any part starts with a non-zero digit. So 999-011-9999 is not allowed.
LAB: Phone number breakdown 0/100
1 phone_number = int(input)
2
3 num_one = s[:3]
4 num_two = s[3:6]
5 num_three = s[6:]
6
7 final_number = '('+num_one+')'+num_two+'-' +num_three
8 print = final_number

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 17:30
Data for which there is temporarily no room in ram is diverted to where on your computer? question 9 options: a) the paging file on the hard drive b) the system file on the hard drive c) the memory file on the hard drive d) the cpu cache
Answers: 2
question
Computers and Technology, 22.06.2019 12:40
In a response of approximately 50 words, explain why it would be essential for the successful a/v technician to participate in additional coursework, presentations and seminars offered by equipment manufacturers as well as annual conferences attended by colleagues in the industry.
Answers: 1
question
Computers and Technology, 22.06.2019 15:30
Why would a programmer use the logical operator and in an if statement? a: when an action is to be taken that requires both conditions to be falseb: when an action is to be taken that requires both conditions to be truec: when an action is to be taken that requires the first condition to be falsed: when an action is to be taken that requires the second condition to be truei took the test and the answer is b.
Answers: 3
question
Computers and Technology, 22.06.2019 17:00
Annie is creating a corporate report for a company’s annual meeting. in the report, she wants to add the signature of various department heads. which device can annie use to capture signatures to include in the report? a. printer b. monitor c. e-reader d. digitizing tablet
Answers: 1
You know the right answer?
Given an integer representing a 10-digit phone number, output the area code, prefix, and line number...
Questions
question
Mathematics, 14.12.2021 05:10
question
Mathematics, 14.12.2021 05:10
question
Physics, 14.12.2021 05:10
question
Mathematics, 14.12.2021 05:10
question
Mathematics, 14.12.2021 05:10
Questions on the website: 13722360