Given an integer representing a 10-digit phone number, output the area code, prefix, and line number using the format XXXXXXXXXX. Input: XXXXXXXXXX Output: XXXXXXXXXX My code: phone_number = input()...


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


Input: 8005551212


Output: (800) 555-1212


My code:


phone_number = input()


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])


However the output is giving me a space between the first parantheses and the number eight ( 800) 555-1212


How can I remove the space to get the correct formating?




May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here