Question

Hi, I need a program written in Python that can translate a phone number into letters....

Hi,

I need a program written in Python that can translate a phone number into letters. The program needs to prompt the user to input a phone number of their choice to translate. I'm in a basic level python class so I would appreciate it if the program wasn't too high skilled or included "char" if possible. Thank you in advance.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

drop a comment if theres a problem

#------INPUT/OUTPUT------

Enter the phone number: 234512

two three four five one two

#---------------------------------

#this list carries all the number in words at their repective indexes

number_words = ["zero ", "one ","two ","three ","four ", "five ", "six ","seven ","eight ","nine "]

# note that zero is at 0th index, "one" is at 1st index and so on

#this prompts the user

number=input("Enter the phone number: ")


output=""

#iterates over every digit in the number, one by one

for digit in number:

    #appends the digit in words at the end of the output string

    output=output+number_words[int(digit)]

print(output)

#-----------------------------------------------

Add a comment
Know the answer?
Add Answer to:
Hi, I need a program written in Python that can translate a phone number into letters....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This is in python. I need to print out a specific message depending on the number...

    This is in python. I need to print out a specific message depending on the number that's input. for example, if the user inputs 1, program should print out "hello". if the user inputs 2, program should print out "hi". But also the program should keep asking for a number to be input after a valid number is input. For example, user inputs 1, program prints out "hello" and then asks the user to input another value. but also the...

  • This is Python The program should accept input from the user as either 7-digit phone number...

    This is Python The program should accept input from the user as either 7-digit phone number or 10-digit. If the user enters 7 characters, the program should automatically add "512" to the beginning of the phone number as the default area code. Dash (hyphen) characters do not count in input character count, but must not be random. If the user enters dashes the total character count must not exceed 12. The program should not crash if the user enters invalid...

  • I have written a program that determines the frequency of letters in an input file. It...

    I have written a program that determines the frequency of letters in an input file. It works perfectly but the only problem is that the output file should put the characters in the order that they appear but they are being put in alphabetical order. Please help. Here is the code: #include <fstream> #include <iostream> using namespace std; int main() {    ofstream out;    out.open("output.txt"); ifstream input("input.txt", ios_base::binary); size_t count[256]; fill_n(count, 256, 0); for (char c; input.get(c); ++count[uint8_t(c)])   ; for (size_t...

  • I NEED THIS PROGRAM COMPLETE WITH THE INPUT ALREADY IN IT. I HAVE NO TIME LEFT...

    I NEED THIS PROGRAM COMPLETE WITH THE INPUT ALREADY IN IT. I HAVE NO TIME LEFT TO GET IT DONE AND IT'S BEEN KICKING MY BEHIND FOR THE PAST FEW DAYS. THIS IS MY FINAL PROGRAM AND I HAVE NO CLUE ABOUT WHAT I'M DOING. SO, IF SOME WILL...WILL YOU PLEASE DO THE PROGRAM WITH THE INPUT ALREADY IN IT...I JUST WANT TO BE ABLE TO COPY PASTE AND RUN IT. I WOULD APPRECIATE IT A HECK OF A LOT....

  • Can you add code comments where required throughout this Python Program, Guess My Number Program, and...

    Can you add code comments where required throughout this Python Program, Guess My Number Program, and describe this program as if you were presenting it to the class. What it does and everything step by step. import random def menu(): #function for getting the user input on what he wants to do print("\n\n1. You guess the number\n2. You type a number and see if the computer can guess it\n3. Exit") while True: #using try-except for the choice will handle the...

  • Hi I need help with a java program that I need to create a Airline Reservation...

    Hi I need help with a java program that I need to create a Airline Reservation System I already finish it but it doesnt work can someone please help me I would be delighted it doesnt show the available seats when running the program and I need it to run until someone says no for booking a seat and if they want to cancel a seat it should ask the user to cancel a seat or continue booking also it...

  • I need help with this python programming exercise, please! thanks in advance Create a Python script...

    I need help with this python programming exercise, please! thanks in advance Create a Python script file called hw4.py. Add your name at the top as a comment, along with the class name and date. Both exercises should be in this file, with a comment before each of them to mark it. Ex. 1. Write a program that inputs an integer number from the user, then prints a letter "O" in ASCII art using a width of 5 and the...

  • Hi, Hi, I need someone to write a program in Phython 3.6, and please I will...

    Hi, Hi, I need someone to write a program in Phython 3.6, and please I will appreciate if the code is error free and indented correctly. The output would be preferable. thanks Write a GUI program that translates the Latin words to English. The window should have three buttons, one for each Latin word. When the user clicks a button, the program displays the English translation in a label. 3. Miles Per Gallon Calculator Write a GUI program that calculates...

  • hi, I'm a new student of c++, I found it's difficult to understand the class, can...

    hi, I'm a new student of c++, I found it's difficult to understand the class, can you guys please give me an example of how to create a two dimensional array in a class. like create an array[3][4] in a class, let the user input the value of array. Thank you.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT