Question
Hello, this is a question regarding Python programming. I need to create a phone number translator that turns a number in letter form (ie 555-EAT-F00D)
Hello, this is a question regarding Python programming. I need to create a phone number translator that turns a number in letter form (ie 555-EAT-F00D) into it's numerical counterpoint.
I have this so far but am having a hard time filling in the blanks to get it to run on the Python IDLE. I believe the trouble area to be in defining "char" and the final command of
"new_phone_num =+ char". Thanks for any and all help! Program code below with current indentation:
phoneNum = input("Enter the number in the format of XXX-XXX-XXXX: ") new_phone_num = "" for var in phoneNum[1:2]: if char in 'ABC': char = "" if char == 'A' or char == 'B' or char == 'C': char == '2' elif char == 'D' or char == 'E' or char == 'F': char = '3' elif char == 'G' or char == 'H' or char == 'I': char = '4' elif char == 'J' or char == 'K' or char == 'L': char = '5' elif char == 'M' or char == 'N' or char == 'O': char = '6' elif char == 'P' or char == 'Q' or char == 'R' or char == 'S': char = '7' elif char == 'T' or char == 'U' or char == 'V': char = '8' elif char == 'W' or char == 'X' or char == 'Y' or char == 'Z': char = '9'
new_phone_num += char print(new_phone_num)
input("Press enter to exit.")
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started