I am out of trial and error again Lists

Denis McMahon denismfmcmahon at gmail.com
Thu Oct 23 05:15:16 EDT 2014


On Wed, 22 Oct 2014 18:30:17 -0400, Seymore4Head wrote:

> One more question.
> if y in str(range(10)
> Why doesn't that work.
> I commented it out and just did it "long hand"

In the last post I made, I suggested to you the mechanisms of using the 
python console and using code which prints out variables after every line.

Try the following 3 commands at the console:

>>> 10
>>> range(10)
>>> str(range(10))

10 is just the number 10
range(10) is a list of 10 integers in the sequence 0 to 9
str(range(10)) is?

Please stop the stab in the dark trial and error coding followed by the 
plaintive "why doesn't it work" wailing, and put some effort into reading 
and understanding the manuals.

If a function doesn't do what you expect with the input you think you've 
given it, there is invariably one of three causes:

a) The input you actually gave it isn't the input you thought you gave it
b) You didn't read the description of the function, and it doesn't in 
fact do what you thought
c) Both a and b above

-- 
Denis McMahon, denismfmcmahon at gmail.com



More information about the Python-list mailing list