Re: I am out of trial and error again Lists

2014-10-27 Thread giacomo boffi
Rustom Mody writes: > What would you say to a person who > - Buys a Lambhorgini I'd say: "Don't buy a Lambhorgini from that nice guy you met at a party, but buy a Lamborghini by an authorized dealer" ;-) -- I was a kid when Lamborghini launched the Miura! -- https://mail.python.org

Re: I am out of trial and error again Lists

2014-10-26 Thread Terry Reedy
On 10/26/2014 1:08 AM, Dennis Lee Bieber wrote: On Sat, 25 Oct 2014 18:48:59 -0400, Terry Reedy declaimed the following: C:\Users\Wulfraed\Documents>python3 You must have done something extra to make this work on Windows. Possibly hand-edited my system PATH -- I've got a rather nas

Re: Side-effects [was Re: I am out of trial and error again Lists]

2014-10-25 Thread Chris Angelico
On Sun, Oct 26, 2014 at 5:12 PM, Steven D'Aprano wrote: > However, mutator methods on a class don't change global state, they change > the state of an instance. Even random.random and friends don't change > global state, they change a (hidden) instance, and you can create your own > instances when

Side-effects [was Re: I am out of trial and error again Lists]

2014-10-25 Thread Steven D'Aprano
Chris Angelico wrote: > On Sat, Oct 25, 2014 at 4:40 PM, Rustom Mody > wrote: >> Its generally accepted that side-effecting functions are not a good idea >> -- typically a function that returns something and changes global state. > > Only in certain circles. Not in Python. There are large number

Re: I am out of trial and error again Lists

2014-10-25 Thread Mark Lawrence
On 25/10/2014 23:48, Terry Reedy wrote: On 10/25/2014 2:23 PM, Dennis Lee Bieber wrote: On Fri, 24 Oct 2014 10:38:31 -0400, Seymore4Head declaimed the following: I do get the difference. I don't actually use Python 2. I use CodeSkulptor. I do have Python 3 installed. Actually I have Pyth

Re: I am out of trial and error again Lists

2014-10-25 Thread Terry Reedy
On 10/25/2014 2:23 PM, Dennis Lee Bieber wrote: On Fri, 24 Oct 2014 10:38:31 -0400, Seymore4Head declaimed the following: I do get the difference. I don't actually use Python 2. I use CodeSkulptor. I do have Python 3 installed. Actually I have Python 2 installed but IDLE defaults to Pytho

Re: I am out of trial and error again Lists

2014-10-25 Thread Denis McMahon
On Fri, 24 Oct 2014 20:15:02 -0400, Seymore4Head wrote: > On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head > wrote: > > name="012" name is a string of 3 characters > b=list(range(3)) b is a list of 3 numbers > print (name[1]) name[1] is the string "1" > print (b[1]) b[1] is the number 1

Re: I am out of trial and error again Lists

2014-10-25 Thread Denis McMahon
On Sat, 25 Oct 2014 15:01:54 +, Grant Edwards wrote: > On 2014-10-24, Denis McMahon wrote: >> On Fri, 24 Oct 2014 10:38:31 -0400, Seymore4Head wrote: >> >>> Thanks everyone for your suggestions. >> >> Try loading the following in codeskulptor: >> >> http://www.codeskulptor.org/#user38_j6kGKge

Re: I am out of trial and error again Lists

2014-10-25 Thread Seymore4Head
On Sat, 25 Oct 2014 14:23:44 -0400, Dennis Lee Bieber wrote: >On Fri, 24 Oct 2014 10:38:31 -0400, Seymore4Head > declaimed the following: > >> >>I do get the difference. I don't actually use Python 2. I use >>CodeSkulptor. I do have Python 3 installed. Actually I have Python 2 >>installed but

Re: I am out of trial and error again Lists

2014-10-25 Thread Rustom Mody
On Saturday, October 25, 2014 1:15:09 PM UTC+5:30, Steven D'Aprano wrote: > Rustom Mody wrote: > > > On Saturday, October 25, 2014 11:20:03 AM UTC+5:30, Chris Angelico wrote: > >> On Sat, Oct 25, 2014 at 4:40 PM, Rustom Mody wrote: > >> > Its generally accepted that side-effecting functions are n

Re: I am out of trial and error again Lists

2014-10-25 Thread Grant Edwards
On 2014-10-24, Denis McMahon wrote: > On Fri, 24 Oct 2014 10:38:31 -0400, Seymore4Head wrote: > >> Thanks everyone for your suggestions. > > Try loading the following in codeskulptor: > > http://www.codeskulptor.org/#user38_j6kGKgeOMr_0.py No. We[1] aren't intested in whatever Python-like langua

Re: I am out of trial and error again Lists

2014-10-25 Thread Ian Kelly
On Sat, Oct 25, 2014 at 12:46 AM, Larry Hudson wrote: >> name="123-xyz-abc" >> for x in name: >> if x in range(10): > > x is a character (a one-element string). range(10) is a list of ints. A > string will never match an int. BTW, as it is used here, range(10) is for > Py2, for Py3 it need

Re: I am out of trial and error again Lists

2014-10-25 Thread Steven D'Aprano
Rustom Mody wrote: > On Saturday, October 25, 2014 11:20:03 AM UTC+5:30, Chris Angelico wrote: >> On Sat, Oct 25, 2014 at 4:40 PM, Rustom Mody wrote: >> > Its generally accepted that side-effecting functions are not a good >> > idea -- typically a function that returns something and changes globa

Re: I am out of trial and error again Lists

2014-10-25 Thread Mark Lawrence
On 25/10/2014 03:41, Seymore4Head wrote: On Fri, 24 Oct 2014 19:16:21 -0700, Larry Hudson wrote: On 10/24/2014 07:38 AM, Seymore4Head wrote: I do get the difference. I don't actually use Python 2. I use CodeSkulptor. I do have Python 3 installed. Actually I have Python 2 installed but ID

Re: I am out of trial and error again Lists

2014-10-24 Thread Larry Hudson
On 10/24/2014 12:07 PM, Seymore4Head wrote: On Fri, 24 Oct 2014 19:40:39 +0100, Mark Lawrence How many more times, state what you expect to happen and what actually happens. "doesn't work" is useless. Please read this http://sscce.org/ Good suggestion. OK how is this? It doesn't print wha

Re: I am out of trial and error again Lists

2014-10-24 Thread Larry Hudson
On 10/24/2014 09:37 AM, Seymore4Head wrote: import string Not needed, delete it. def nametonumber(name): lst=[] nx=[] digit=[] Not needed. You create digit as an empty list, them immediately follow by assigning a string to it (NOT a _list_ of characters, but an actual string

Re: I am out of trial and error again Lists

2014-10-24 Thread Chris Angelico
On Sat, Oct 25, 2014 at 4:55 PM, Rustom Mody wrote: > So give me a valid (ie useful) use where instead of the usual > l=[1,2,3] > l.append(4) > > we have > > foo(l.append(4)) Given that l.append(4) will always return None, there's not a lot of point passing that return value to something, unless

Re: I am out of trial and error again Lists

2014-10-24 Thread Rustom Mody
On Saturday, October 25, 2014 11:20:03 AM UTC+5:30, Chris Angelico wrote: > On Sat, Oct 25, 2014 at 4:40 PM, Rustom Mody wrote: > > Its generally accepted that side-effecting functions are not a good idea > > -- typically a function that returns something and changes global state. > > Only in cer

Re: I am out of trial and error again Lists

2014-10-24 Thread Chris Angelico
On Sat, Oct 25, 2014 at 4:40 PM, Rustom Mody wrote: > Its generally accepted that side-effecting functions are not a good idea > -- typically a function that returns something and changes global state. Only in certain circles. Not in Python. There are large numbers of functions with side effects

Re: I am out of trial and error again Lists

2014-10-24 Thread Rustom Mody
On Saturday, October 25, 2014 9:56:02 AM UTC+5:30, Ben Finney wrote: > Rustom Mody writes: > > > On Saturday, October 25, 2014 9:17:12 AM UTC+5:30, Rustom Mody wrote: > > > 4. The least useful statement to try at the interpreter is print. > > > > Yeah this is python2 thinking; in python 3, print i

Re: I am out of trial and error again Lists

2014-10-24 Thread Ben Finney
Rustom Mody writes: > On Saturday, October 25, 2014 9:17:12 AM UTC+5:30, Rustom Mody wrote: > > 4. The least useful statement to try at the interpreter is print. > > Yeah this is python2 thinking; in python 3, print is technically an > expression. This is wrong thinking. In Python 3, print is a

Re: I am out of trial and error again Lists

2014-10-24 Thread Rustom Mody
On Saturday, October 25, 2014 9:17:12 AM UTC+5:30, Rustom Mody wrote: > 4. The least useful statement to try at the interpreter is print. Yeah this is python2 thinking; in python 3, print is technically an expression. -- https://mail.python.org/mailman/listinfo/python-list

Re: I am out of trial and error again Lists

2014-10-24 Thread Rustom Mody
On Saturday, October 25, 2014 5:21:01 AM UTC+5:30, Seymore4Head wrote: > On Fri, 24 Oct 2014 16:27:58 -0700 (PDT), Rustom Mody wrote: > > >On Saturday, October 25, 2014 4:30:47 AM UTC+5:30, Seymore4Head wrote: > >> On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head wrote: > >> > >> name="123-xyz-ab

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Fri, 24 Oct 2014 19:16:21 -0700, Larry Hudson wrote: >On 10/24/2014 07:38 AM, Seymore4Head wrote: > >> I do get the difference. I don't actually use Python 2. I use >> CodeSkulptor. I do have Python 3 installed. Actually I have Python 2 >> installed but IDLE defaults to Python 3. So it is

Re: I am out of trial and error again Lists

2014-10-24 Thread Larry Hudson
On 10/24/2014 07:38 AM, Seymore4Head wrote: I do get the difference. I don't actually use Python 2. I use CodeSkulptor. I do have Python 3 installed. Actually I have Python 2 installed but IDLE defaults to Python 3. So it is a pain to actually load Python 2. Exactly HOW are you trying to

Re: I am out of trial and error again Lists

2014-10-24 Thread Cameron Simpson
On 24Oct2014 20:37, Seymore4Head wrote: On Sat, 25 Oct 2014 01:20:53 +0100, MRAB One function you can use is repr: x = 1 y = "1" print(repr(x)) print(repr(y)) This will print: 1 '1' OK, now it's clear that x is an int and y is a string. Yes In particular, Python's interactive mode uses

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Fri, 24 Oct 2014 20:27:03 -0400, Terry Reedy wrote: >On 10/24/2014 6:27 PM, Seymore4Head wrote: > >> I promise I am not trying to frustrate anyone. I know I have. > >Seymore, if you want to learn real Python, download and install 3.4.2 >and either use the Idle Shell and Editor or the interac

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Sat, 25 Oct 2014 01:20:53 +0100, MRAB wrote: >On 2014-10-25 00:57, Seymore4Head wrote: >[snip] >> Wait! I don't get it. >> name="012" >> b=list(range(3)) >> print (name[1]) >> print (b[1]) >> 1 >> 1 >> >> I forgot the b >> >If you print the int 1, you'll see: > >1 > >If you print the string "

Re: I am out of trial and error again Lists

2014-10-24 Thread Terry Reedy
On 10/24/2014 6:27 PM, Seymore4Head wrote: I promise I am not trying to frustrate anyone. I know I have. Seymore, if you want to learn real Python, download and install 3.4.2 and either use the Idle Shell and Editor or the interactive console interpreter and a decent programmer editor. I

Re: I am out of trial and error again Lists

2014-10-24 Thread MRAB
On 2014-10-25 00:57, Seymore4Head wrote: [snip] Wait! I don't get it. name="012" b=list(range(3)) print (name[1]) print (b[1]) 1 1 I forgot the b If you print the int 1, you'll see: 1 If you print the string "1", you'll see: 1 Normally you want it to print only the characters of the strin

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head wrote: name="012" b=list(range(3)) print (name[1]) print (b[1]) if name[1] == b[1]: print ("Eureka!") else: print ("OK, I get it") -- https://mail.python.org/mailman/listinfo/python-list

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Fri, 24 Oct 2014 19:48:16 -0400, Seymore4Head wrote: >On Fri, 24 Oct 2014 16:27:58 -0700 (PDT), Rustom Mody > wrote: > >>On Saturday, October 25, 2014 4:30:47 AM UTC+5:30, Seymore4Head wrote: >>> On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head wrote: >>> >>> name="123-xyz-abc" >>> a=range(1

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Fri, 24 Oct 2014 23:21:43 + (UTC), Denis McMahon wrote: >On Fri, 24 Oct 2014 16:58:00 -0400, Seymore4Head wrote: > >> I make lots of typing mistakes. It is not that. Did you see the short >> example I posted? >> >> name="123-xyz-abc" >> for x in name: >> if x in range(10): >>

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Fri, 24 Oct 2014 16:27:58 -0700 (PDT), Rustom Mody wrote: >On Saturday, October 25, 2014 4:30:47 AM UTC+5:30, Seymore4Head wrote: >> On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head wrote: >> >> name="123-xyz-abc" >> a=range(10) >> b=list(range(10)) >> c=str(list(range(10))) >> print ("a",(a

Re: I am out of trial and error again Lists

2014-10-24 Thread Denis McMahon
On Fri, 24 Oct 2014 18:58:04 -0400, Seymore4Head wrote: > On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head > wrote: OK, assuming you tried to run this in python3, not python2 or codeskulptor. > name="123-xyz-abc" > a=range(10) a is an iterable object giving the numbers 0 through 9 > b=

Re: I am out of trial and error again Lists

2014-10-24 Thread Rustom Mody
On Saturday, October 25, 2014 4:30:47 AM UTC+5:30, Seymore4Head wrote: > On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head wrote: > > name="123-xyz-abc" > a=range(10) > b=list(range(10)) > c=str(list(range(10))) > print ("a",(a)) > print ("b",(b)) > print ("c",(c)) > > for x in name: > if x i

Re: I am out of trial and error again Lists

2014-10-24 Thread Mark Lawrence
On 24/10/2014 23:58, Seymore4Head wrote: On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head wrote: name="123-xyz-abc" a=range(10) b=list(range(10)) c=str(list(range(10))) print ("a",(a)) print ("b",(b)) print ("c",(c)) for x in name: if x in a: print ("a",(x)) if x in b:

Re: I am out of trial and error again Lists

2014-10-24 Thread Denis McMahon
On Fri, 24 Oct 2014 16:58:00 -0400, Seymore4Head wrote: > I make lots of typing mistakes. It is not that. Did you see the short > example I posted? > > name="123-xyz-abc" > for x in name: > if x in range(10): > print ("Range",(x)) > if x in str(range(10)): > print ("Strin

Re: I am out of trial and error again Lists

2014-10-24 Thread Denis McMahon
On Fri, 24 Oct 2014 17:35:34 -0400, Seymore4Head wrote: >>But finally, with your telephone number decoder, look at: >> >>http://www.codeskulptor.org/#user38_QnR06Upp4AH6h0Q.py > > That is much cleaner than mine. Nice. > > I did make one more change to mine that makes it easier to read. I > chan

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head wrote: name="123-xyz-abc" a=range(10) b=list(range(10)) c=str(list(range(10))) print ("a",(a)) print ("b",(b)) print ("c",(c)) for x in name: if x in a: print ("a",(x)) if x in b: print ("b",(x)) if x in c:

Re: I am out of trial and error again Lists

2014-10-24 Thread Rustom Mody
On Saturday, October 25, 2014 4:00:01 AM UTC+5:30, Seymore4Head wrote: > On Fri, 24 Oct 2014 18:09:59 -0400 (EDT), Dave Angel wrote: > > Don't ever retype unless you're trying to > > frustrate us, > > I promise I am not trying to frustrate anyone. I know I have. > Sorry No issues Seymore :-) As

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Fri, 24 Oct 2014 18:09:59 -0400 (EDT), Dave Angel wrote: >Seymore4Head Wrote in message: >> On Fri, 24 Oct 2014 09:54:23 -0700 (PDT), Rustom Mody >> wrote: >> >>>Totally befuddled myself! >>> >>>Are you deliberately misspelling list to lst >>>and hoping the error will go away. >>> >>>And Pu

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head wrote: Thanks for all the helpful replies. I just discovered that there is something wrong with my news feed. Some of the messages did not make it to me. I can go back and read this thread in Google Groups but I can't reply to it. If I missed t

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Fri, 24 Oct 2014 21:48:14 + (UTC), Denis McMahon wrote: >On Fri, 24 Oct 2014 10:38:31 -0400, Seymore4Head wrote: > >> Thanks everyone for your suggestions. > >Try loading the following in codeskulptor: > >http://www.codeskulptor.org/#user38_j6kGKgeOMr_0.py That is a useful way to test. Th

Re: I am out of trial and error again Lists

2014-10-24 Thread Dave Angel
Seymore4Head Wrote in message: > On Fri, 24 Oct 2014 09:54:23 -0700 (PDT), Rustom Mody > wrote: > >>Totally befuddled myself! >> >>Are you deliberately misspelling list to lst >>and hoping the error will go away. >> >>And Puh LEESE >>dont post screen shots of good ol ASCII text > > I didn't do

Re: I am out of trial and error again Lists

2014-10-24 Thread Denis McMahon
On Fri, 24 Oct 2014 15:07:06 -0400, Seymore4Head wrote: > On Fri, 24 Oct 2014 19:40:39 +0100, Mark Lawrence > wrote: > >>On 24/10/2014 19:20, Seymore4Head wrote: >>> I meant to type: >>> if y in range(1,10) doesn't work. >>> Sigh Sorry >>> >>> >>How many more times, state what you expect to happ

Re: I am out of trial and error again Lists

2014-10-24 Thread Denis McMahon
On Fri, 24 Oct 2014 10:38:31 -0400, Seymore4Head wrote: > Thanks everyone for your suggestions. Try loading the following in codeskulptor: http://www.codeskulptor.org/#user38_j6kGKgeOMr_0.py -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Fri, 24 Oct 2014 21:19:22 + (UTC), Denis McMahon wrote: >On Fri, 24 Oct 2014 14:15:13 -0400, Seymore4Head wrote: > >> 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

Re: I am out of trial and error again Lists

2014-10-24 Thread Denis McMahon
On Fri, 24 Oct 2014 14:15:13 -0400, Seymore4Head wrote: > 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(

Re: I am out of trial and error again Lists

2014-10-24 Thread Ian Kelly
On Fri, Oct 24, 2014 at 2:58 PM, Seymore4Head wrote: > name="123-xyz-abc" > for x in name: > if x in range(10): > print ("Range",(x)) > if x in str(range(10)): > print ("String range",(x)) > > It doesn't throw an error but it doesn't print what you would expect. That print

Re: I am out of trial and error again Lists

2014-10-24 Thread mm0fmf
On 24/10/2014 15:47, Seymore4Head wrote: I have at least 10 ebooks. I will get around to reading them soon. Sooner would be better. -- https://mail.python.org/mailman/listinfo/python-list

Re: I am out of trial and error again Lists

2014-10-24 Thread alister
On Fri, 24 Oct 2014 16:58:00 -0400, Seymore4Head wrote: > On Fri, 24 Oct 2014 20:37:31 + (UTC), Denis McMahon > wrote: > >>On Fri, 24 Oct 2014 10:38:31 -0400, Seymore4Head wrote: >> >>> I tried list(range(10) >> >>This is missing a ")" >> >>It probably sat there waiting for you to finish the

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Fri, 24 Oct 2014 20:37:31 + (UTC), Denis McMahon wrote: >On Fri, 24 Oct 2014 10:38:31 -0400, Seymore4Head wrote: > >> I tried list(range(10) > >This is missing a ")" > >It probably sat there waiting for you to finish the line. > >list(range(10)) > >You have two "(" in the line, you need

Re: I am out of trial and error again Lists

2014-10-24 Thread Denis McMahon
On Fri, 24 Oct 2014 10:38:31 -0400, Seymore4Head wrote: > I tried list(range(10) This is missing a ")" It probably sat there waiting for you to finish the line. list(range(10)) You have two "(" in the line, you need two ")" to match them. > I thought that would work in Python 3. It > didn

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Fri, 24 Oct 2014 12:55:19 -0700 (PDT), sohcahto...@gmail.com wrote: >On Friday, October 24, 2014 12:36:23 PM UTC-7, Seymore4Head wrote: >> On Fri, 24 Oct 2014 12:25:33 -0700 (PDT), sohcahto...@gmail.com wrote: >> >> >On Friday, October 24, 2014 12:12:10 PM UTC-7, Seymore4Head wrote: >> >> On F

Re: I am out of trial and error again Lists

2014-10-24 Thread sohcahtoa82
On Friday, October 24, 2014 12:36:23 PM UTC-7, Seymore4Head wrote: > On Fri, 24 Oct 2014 12:25:33 -0700 (PDT), sohcahto...@gmail.com wrote: > > >On Friday, October 24, 2014 12:12:10 PM UTC-7, Seymore4Head wrote: > >> On Fri, 24 Oct 2014 11:57:12 -0700 (PDT), sohcahto...@gmail.com wrote: > >> > >>

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Fri, 24 Oct 2014 12:25:33 -0700 (PDT), sohcahto...@gmail.com wrote: >On Friday, October 24, 2014 12:12:10 PM UTC-7, Seymore4Head wrote: >> On Fri, 24 Oct 2014 11:57:12 -0700 (PDT), sohcahto...@gmail.com wrote: >> >> >On Friday, October 24, 2014 11:17:53 AM UTC-7, Seymore4Head wrote: >> >> On F

Re: I am out of trial and error again Lists

2014-10-24 Thread sohcahtoa82
On Friday, October 24, 2014 12:12:10 PM UTC-7, Seymore4Head wrote: > On Fri, 24 Oct 2014 11:57:12 -0700 (PDT), sohcahto...@gmail.com wrote: > > >On Friday, October 24, 2014 11:17:53 AM UTC-7, Seymore4Head wrote: > >> On Fri, 24 Oct 2014 11:52:15 -0600, Ian Kelly > >> wrote: > >> > >> >On Fri, Oc

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Fri, 24 Oct 2014 11:57:12 -0700 (PDT), sohcahto...@gmail.com wrote: >On Friday, October 24, 2014 11:17:53 AM UTC-7, Seymore4Head wrote: >> On Fri, 24 Oct 2014 11:52:15 -0600, Ian Kelly >> wrote: >> >> >On Fri, Oct 24, 2014 at 11:03 AM, Seymore4Head >> > wrote: >> >> Actually I was a little fr

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Fri, 24 Oct 2014 19:40:39 +0100, Mark Lawrence wrote: >On 24/10/2014 19:20, Seymore4Head wrote: >> I meant to type: >> if y in range(1,10) doesn't work. >> Sigh >> Sorry >> > >How many more times, state what you expect to happen and what actually >happens. "doesn't work" is useless. Please

Re: I am out of trial and error again Lists

2014-10-24 Thread sohcahtoa82
On Friday, October 24, 2014 11:17:53 AM UTC-7, Seymore4Head wrote: > On Fri, 24 Oct 2014 11:52:15 -0600, Ian Kelly > wrote: > > >On Fri, Oct 24, 2014 at 11:03 AM, Seymore4Head > > wrote: > >> Actually I was a little frustrated when I added that line back in as > >> the other lines all work. > >>

Re: I am out of trial and error again Lists

2014-10-24 Thread Mark Lawrence
On 24/10/2014 19:20, Seymore4Head wrote: I meant to type: if y in range(1,10) doesn't work. Sigh Sorry How many more times, state what you expect to happen and what actually happens. "doesn't work" is useless. Please read this http://sscce.org/ -- My fellow Pythonistas, ask not what our l

Re: I am out of trial and error again Lists

2014-10-24 Thread Mark Lawrence
On 24/10/2014 18:03, Seymore4Head wrote: 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. Yo

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
I meant to type: if y in range(1,10) doesn't work. Sigh Sorry On Fri, 24 Oct 2014 14:15:13 -0400, Seymore4Head wrote: >On Fri, 24 Oct 2014 11:52:15 -0600, Ian Kelly >wrote: > >>On Fri, Oct 24, 2014 at 11:03 AM, Seymore4Head >> wrote: >>> Actually I was a little frustrated when I added that line

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Fri, 24 Oct 2014 11:52:15 -0600, Ian Kelly wrote: >On Fri, Oct 24, 2014 at 11:03 AM, Seymore4Head > wrote: >> 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.im

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Fri, 24 Oct 2014 10:42:08 -0700 (PDT), Rustom Mody wrote: >On Friday, October 24, 2014 10:55:44 PM UTC+5:30, Seymore4Head wrote: >> On Fri, 24 Oct 2014 19:18:12 +0200, "Albert Visser" wrote: >> >> >On Fri, 24 Oct 2014 19:03:47 +0200, Seymore4Head wrote: >> > >> >> >> >> http://i.imgur.com/DT

Re: I am out of trial and error again Lists

2014-10-24 Thread Ian Kelly
On Fri, Oct 24, 2014 at 11:03 AM, Seymore4Head wrote: > 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

Re: I am out of trial and error again Lists

2014-10-24 Thread Rustom Mody
On Friday, October 24, 2014 10:55:44 PM UTC+5:30, Seymore4Head wrote: > On Fri, 24 Oct 2014 19:18:12 +0200, "Albert Visser" wrote: > > >On Fri, 24 Oct 2014 19:03:47 +0200, Seymore4Head wrote: > > > >> > >> http://i.imgur.com/DTc5zoL.jpg > >> > >> The interpreter. I don't know how to use that ei

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Fri, 24 Oct 2014 19:18:12 +0200, "Albert Visser" wrote: >On Fri, 24 Oct 2014 19:03:47 +0200, Seymore4Head > wrote: > >> >> http://i.imgur.com/DTc5zoL.jpg >> >> The interpreter. I don't know how to use that either. >> > >It's what's on the left hand side of your screenshot. You can simply t

Re: I am out of trial and error again Lists

2014-10-24 Thread Rustom Mody
On Friday, October 24, 2014 10:37:45 PM UTC+5:30, Seymore4Head wrote: > On Fri, 24 Oct 2014 09:54:23 -0700 (PDT), Rustom Mody wrote: > > >Totally befuddled myself! > > > >Are you deliberately misspelling list to lst > >and hoping the error will go away. > > > >And Puh LEESE > >dont post screen sho

Re: I am out of trial and error again Lists

2014-10-24 Thread Albert Visser
On Fri, 24 Oct 2014 19:03:47 +0200, Seymore4Head wrote: http://i.imgur.com/DTc5zoL.jpg The interpreter. I don't know how to use that either. It's what's on the left hand side of your screenshot. You can simply type Python statements following the >>> prompt and hit enter to examine t

Re: I am out of trial and error again Lists

2014-10-24 Thread Chris Angelico
On Sat, Oct 25, 2014 at 4:05 AM, Ian Kelly wrote: > The name of the builtin is "list". It's a function* that takes an > argument and uses it to construct a list, which it returns. > > *Actually it's a type object, and calling it causes an instance of the > type to be constructed, but for all inten

Re: I am out of trial and error again Lists

2014-10-24 Thread Rustom Mody
On Friday, October 24, 2014 10:06:47 PM UTC+5:30, Ian wrote: > On Fri, Oct 24, 2014 at 9:56 AM, Rustom Mody wrote: > >> Range(10) stores the min max values and loads each number in between > >> when needed. > > > > It loads?? As in 'load-up-a-van'?? > > As in loads into memory. > > > When you see

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Fri, 24 Oct 2014 09:54:23 -0700 (PDT), Rustom Mody wrote: >Totally befuddled myself! > >Are you deliberately misspelling list to lst >and hoping the error will go away. > >And Puh LEESE >dont post screen shots of good ol ASCII text I didn't do that on purpose. I make a lot of typing mistakes

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Sat, 25 Oct 2014 03:47:51 +1100, Chris Angelico wrote: >On Sat, Oct 25, 2014 at 3:37 AM, Seymore4Head > wrote: >> When I use list(range(10)) I get: >> Traceback (most recent call last): >> File "C:/Functions/name to number digit.py", line 37, in >> print (nametonumber(a))#1800 438 2427

Re: I am out of trial and error again Lists

2014-10-24 Thread Ian Kelly
On Fri, Oct 24, 2014 at 10:37 AM, Seymore4Head wrote: > If I could explain to you why something doesn't work then I could fix > it myself. I don't understand why it doesn't work. The best I can do > is repost the code. You don't need to be able to explain why it doesn't work. You just need to b

Re: I am out of trial and error again Lists

2014-10-24 Thread Rustom Mody
On Friday, October 24, 2014 10:18:12 PM UTC+5:30, Chris Angelico wrote: > On Sat, Oct 25, 2014 at 3:37 AM, Seymore4Head wrote: > > When I use list(range(10)) I get: > > Traceback (most recent call last): > > File "C:/Functions/name to number digit.py", line 37, in > > print (nametonumber(a))

Re: I am out of trial and error again Lists

2014-10-24 Thread Rustom Mody
Totally befuddled myself! Are you deliberately misspelling list to lst and hoping the error will go away. And Puh LEESE dont post screen shots of good ol ASCII text -- https://mail.python.org/mailman/listinfo/python-list

Re: I am out of trial and error again Lists

2014-10-24 Thread Chris Angelico
On Sat, Oct 25, 2014 at 3:37 AM, Seymore4Head wrote: > When I use list(range(10)) I get: > Traceback (most recent call last): > File "C:/Functions/name to number digit.py", line 37, in > print (nametonumber(a))#1800 438 2427 837 > File "C:/Functions/name to number digit.py", line 10, in >

Re: I am out of trial and error again Lists

2014-10-24 Thread Albert-Jan Roskam
- On Fri, Oct 24, 2014 5:56 PM CEST Rustom Mody wrote: >On Friday, October 24, 2014 8:11:12 PM UTC+5:30, Seymore4Head wrote: >> On Thu, 23 Oct 2014 21:56:31 -0700 (PDT), Rustom Mody wrote: >> >> >On Thursday, October 23, 2014 10:33:57 PM UTC+5:30, Seymore4Head wrote:

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Fri, 24 Oct 2014 08:56:31 -0700 (PDT), Rustom Mody wrote: >On Friday, October 24, 2014 8:11:12 PM UTC+5:30, Seymore4Head wrote: >> On Thu, 23 Oct 2014 21:56:31 -0700 (PDT), Rustom Mody wrote: >> >> >On Thursday, October 23, 2014 10:33:57 PM UTC+5:30, Seymore4Head wrote: >> >> On Thu, 23 Oct 2

Re: I am out of trial and error again Lists

2014-10-24 Thread Ian Kelly
On Fri, Oct 24, 2014 at 9:56 AM, Rustom Mody wrote: >> Range(10) stores the min max values and loads each number in between >> when needed. > > It loads?? As in 'load-up-a-van'?? As in loads into memory. > When you see: > 10 > 10 > > 1. Does someone (a clerk maybe) in the computer count to

Re: I am out of trial and error again Lists

2014-10-24 Thread giacomo boffi
ERRATA CORRIGE: > many different circumstances, by the very, very helpful folks of clp. many different circumstances, by the very, very helpful folks of clpy -- sapete contare fino a venticinque? Olimpia Milano Jugoplastika Split Partizan Beograd Roberto Premier Duska Ivanovic Zarko Paspalj --

Re: I am out of trial and error again Lists

2014-10-24 Thread Rustom Mody
On Friday, October 24, 2014 8:11:12 PM UTC+5:30, Seymore4Head wrote: > On Thu, 23 Oct 2014 21:56:31 -0700 (PDT), Rustom Mody wrote: > > >On Thursday, October 23, 2014 10:33:57 PM UTC+5:30, Seymore4Head wrote: > >> On Thu, 23 Oct 2014 15:55:35 + (UTC), Denis McMahon wrote: > >> > >> >On Thu, 2

Re: I am out of trial and error again Lists

2014-10-24 Thread Chris Angelico
On Sat, Oct 25, 2014 at 2:04 AM, Seymore4Head wrote: > I understand that it makes it easier for you if I can describe better > the error I get, but by the time I ask for help here I have tried many > different things to get the error to go away. That's part of the problem. You let yourself get fr

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Sat, 25 Oct 2014 01:51:41 +1100, Chris Angelico wrote: >On Sat, Oct 25, 2014 at 1:38 AM, Seymore4Head > wrote: >> I tried list(range(10) I thought that would work in Python 3. It >> didn't. > >This is your problem: You say "it didn't work". That is almost *never* >the right thing to say or t

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Fri, 24 Oct 2014 09:12:28 +0100, Mark Lawrence wrote: >On 24/10/2014 08:05, Mark Lawrence wrote: >> On 22/10/2014 21:30, Seymore4Head wrote: >>> def nametonumber(name): >>> lst=[""] >>> for x,y in enumerate (name): >>> lst=lst.append(y) >>> print (lst) >>> return (

Re: I am out of trial and error again Lists

2014-10-24 Thread Chris Angelico
On Sat, Oct 25, 2014 at 1:38 AM, Seymore4Head wrote: > I tried list(range(10) I thought that would work in Python 3. It > didn't. This is your problem: You say "it didn't work". That is almost *never* the right thing to say or to think. What happened when you tried that? Did you get a SyntaxErr

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Fri, 24 Oct 2014 08:05:01 +0100, Mark Lawrence wrote: >On 22/10/2014 21:30, Seymore4Head wrote: >> def nametonumber(name): >> lst=[""] >> for x,y in enumerate (name): >> lst=lst.append(y) >> print (lst) >> return (lst) >> a=["1-800-getcharter"] >> print (nametonumb

Re: I am out of trial and error again Lists

2014-10-24 Thread Seymore4Head
On Thu, 23 Oct 2014 21:56:31 -0700 (PDT), Rustom Mody wrote: >On Thursday, October 23, 2014 10:33:57 PM UTC+5:30, Seymore4Head wrote: >> On Thu, 23 Oct 2014 15:55:35 + (UTC), Denis McMahon wrote: >> >> >On Thu, 23 Oct 2014 10:04:56 -0400, Seymore4Head wrote: >> > >> >> On Thu, 23 Oct 2014 09

Re: I am out of trial and error again Lists

2014-10-24 Thread Mark Lawrence
On 24/10/2014 08:05, Mark Lawrence wrote: On 22/10/2014 21:30, Seymore4Head wrote: def nametonumber(name): lst=[""] for x,y in enumerate (name): lst=lst.append(y) print (lst) return (lst) a=["1-800-getcharter"] print (nametonumber(a))#18004382427837 The syntax for

Re: I am out of trial and error again Lists

2014-10-24 Thread Mark Lawrence
On 22/10/2014 21:30, Seymore4Head wrote: def nametonumber(name): lst=[""] for x,y in enumerate (name): lst=lst.append(y) print (lst) return (lst) a=["1-800-getcharter"] print (nametonumber(a))#18004382427837 The syntax for when to use a () and when to use [] still t

Re: I am out of trial and error again Lists

2014-10-23 Thread Rustom Mody
On Thursday, October 23, 2014 10:33:57 PM UTC+5:30, Seymore4Head wrote: > On Thu, 23 Oct 2014 15:55:35 + (UTC), Denis McMahon wrote: > > >On Thu, 23 Oct 2014 10:04:56 -0400, Seymore4Head wrote: > > > >> On Thu, 23 Oct 2014 09:15:16 + (UTC), Denis McMahon wrote: > > > >>>Try the following 3

Re: I am out of trial and error again Lists

2014-10-23 Thread Chris Angelico
On Fri, Oct 24, 2014 at 2:14 PM, Terry Reedy wrote: > Example that works 'instantly' in 3.x, but would be slightly insane in 2.x, > even if you have enough memory for it to work on a 64 bit build. > r =range(0, 1000, 37) 3428761974385 in r > False 3428761974386 in r

Re: I am out of trial and error again Lists

2014-10-23 Thread Terry Reedy
On 10/23/2014 3:39 PM, Ian Kelly wrote: On Thu, Oct 23, 2014 at 11:07 AM, Seymore4Head wrote: BTW I forgot to add that example 2 and 3 don't seem to be too useful in Python 3, but they are in Python 2. I don't understand how the Python 3 is an improved version. In Python 2, range returns a l

Re: I am out of trial and error again Lists

2014-10-23 Thread Larry Hudson
On 10/23/2014 01:44 PM, Seymore4Head wrote: I tried to make range(10) work in Python 3 by: if int(y) in range(10): name.append(str(y)) It doesn't. That's true, it doesn't. However, did you actually READ the error message it gives? It has NOTHING to do with range().

Re: I am out of trial and error again Lists

2014-10-23 Thread MRAB
On 2014-10-23 21:44, Seymore4Head wrote: [snip] I tried to make range(10) work in Python 3 by: if int(y) in range(10): name.append(str(y)) It doesn't. You didn't say what happened when you tried, but I can guess. When given, say, "g", it complains that it's not valid. W

Re: I am out of trial and error again Lists

2014-10-23 Thread Seymore4Head
On Thu, 23 Oct 2014 13:39:06 -0600, Ian Kelly wrote: >On Thu, Oct 23, 2014 at 11:07 AM, Seymore4Head > wrote: >> BTW I forgot to add that example 2 and 3 don't seem to be too useful >> in Python 3, but they are in Python 2. I don't understand how the >> Python 3 is an improved version. > >In Pyt

Re: I am out of trial and error again Lists

2014-10-23 Thread Seymore4Head
On Thu, 23 Oct 2014 13:39:06 -0600, Ian Kelly wrote: >On Thu, Oct 23, 2014 at 11:07 AM, Seymore4Head > wrote: >> BTW I forgot to add that example 2 and 3 don't seem to be too useful >> in Python 3, but they are in Python 2. I don't understand how the >> Python 3 is an improved version. > >In Pyt

Re: I am out of trial and error again Lists

2014-10-23 Thread Ian Kelly
On Thu, Oct 23, 2014 at 11:07 AM, Seymore4Head wrote: > BTW I forgot to add that example 2 and 3 don't seem to be too useful > in Python 3, but they are in Python 2. I don't understand how the > Python 3 is an improved version. In Python 2, range returns a list containing all the requested eleme

  1   2   >