r/dailyprogrammer • u/mattryan • Mar 05 '12
[3/5/2012] Challenge #18 [easy]
Often times in commercials, phone numbers contain letters so that they're easy to remember (e.g. 1-800-VERIZON). Write a program that will convert a phone number that contains letters into a phone number with only numbers and the appropriate dash. Click here to learn more about the telephone keypad.
Example Execution: Input: 1-800-COMCAST Output: 1-800-266-2278
13
Upvotes
3
u/bigmell Mar 05 '12
Perl
2
u/prophile Mar 05 '12
Done in four lines of Python.
1
u/Steve132 0 1 Mar 06 '12
C++0x
1
u/Devanon Mar 06 '12 edited Mar 06 '12
Ruby:
I can't execute it now (at work without a ruby interpreter on this PC), so I am not sure if that works as expected...
*Checked, it works :)
1
u/cooper6581 Mar 06 '12
Common Lisp: (Doesn't output the dash, and only works for letters in caps)
1
u/Should_I_say_this Jun 24 '12 edited Jun 24 '12
python 3.2
1
u/ragtag_creature Dec 14 '22
R
0
u/[deleted] Mar 08 '12
[deleted] — view deleted comment