# I am out of trial and error again Lists

Fri Oct 24 20:15:13 CEST 2014

```On Fri, 24 Oct 2014 11:52:15 -0600, Ian Kelly <ian.g.kelly at gmail.com>
wrote:

>On Fri, Oct 24, 2014 at 11:03 AM, Seymore4Head
>> Actually I was a little frustrated when I added that line back in as
>> the other lines all work.
>> Using list(range(10)) Doesn't throw an error but it doesn't work.
>>
>> http://i.imgur.com/DTc5zoL.jpg
>>
>> The interpreter.   I don't know how to use that either.
>
>Try both of these in the interpreter, and observe the difference:
>
>7 in range(10)
>
>"7" in range(10)
>
>Do you understand what the difference between 7 and "7" is?

I do understand that.  7 is a number and "7" is a string.
What my question was...and still is...is why
Python 3 fails when I try using
y=1 800 get charter

y in range str(range(10))
should work because y is a string and str(range(10)) should be
"y" in str(1) fails.
It doesn't give an error it's just not True when y is a number.

These hints are just not working.  I am too thick for hints. :)
If you could use it in the code, I might understand.
The other work arounds that were posted work.
I have used them.  str(range(10)) doesn't work.

import string
def nametonumber(name):
lst=[]
nx=[]
digit=[]
digit="".join(str(i) for i in range(10))
for x in name:
lst.append(x)
for y in (lst):
if y in list(range(1,10)):
#if y in "1234567890":
#if y.isdigit():
#if y in digit:
#if y in string.digits:
nx.append(y)
if y in " -()":
nx.append(y)
if y in "abc":
nx.append("2")
if y in "def":
nx.append("3")
if y in "ghi":
nx.append("4")
if y in "jkl":
nx.append("5")
if y in "mno":
nx.append("6")
if y in "pqrs":
nx.append("7")
if y in "tuv":
nx.append("8")
if y in "wxyz":
nx.append("9")
number="".join(e for e in nx)
return number
a="1-800-getcharter"
print (nametonumber(a))#1800 438 2427 837
a="1-800-leo laporte"
print (nametonumber(a))
a="1 800 dialaho"
print (nametonumber(a))