Hey,
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.
jcp200817
0
Newbie Poster
Recommended Answers
Jump to PostWell 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
lllllIllIlllI
178
Veteran Poster
bvdet
75
Junior Poster
woooee
814
Nearly a Posting Maven
jcp200817
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.