I have to do a script for class in which a user inputs a phone number like the ones you see on TV. 555-buy-this I need to make a script that will change the alphabetic characters to numbers. I asked my teacher and he said we had to do it using a list. I am totally lost and would appreciate any help.
Jump to Post
Well there are a few ways to do it. Preferably i would use a dictionary but as we cant here is another way:
import string number = raw_input("Please enter the number:").lower() n_list = list(number) for enu,f in enumerate(number): if f in string.ascii_lowercase: i = string.ascii_lowercase.index(f)+2 i /= …
All 4 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.