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, 22.06.2019 14:50
Drag each label to the correct location on the image list the do’s and don’ts of safeguarding your password. a. keep yourself logged in when you leave your computer.b. don’t write your password down and leave it where others can find it.c. share your password with your friends.d.each time you visit a website,retain the cookies on your computer.e. use a long password with mixed characters.1. do's 2. don'ts
Answers: 2
question
Computers and Technology, 23.06.2019 06:30
How do you write an argumentative essay about the importance of free enterprise ?
Answers: 1
question
Computers and Technology, 23.06.2019 07:00
What are three software programs for mobile computing?
Answers: 1
question
Computers and Technology, 24.06.2019 00:00
Which tool could be used to display only rows containing presidents who served two terms
Answers: 3
You know the right answer?
Given an integer representing a 10-digit phone number, output the area code, prefix, and line number...
Questions
question
English, 15.12.2021 05:00
question
Mathematics, 15.12.2021 05:00
question
History, 15.12.2021 05:10