[Tutor] Jion list!

2013-05-24 Thread jiangtao sheng
Hi,i am JiangtaoSheng!! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] challenge-chapter 2

2013-05-24 Thread Steven D'Aprano
On 25/05/13 09:41, bob gailer wrote: On 5/22/2013 1:02 AM, Andrew Triplett wrote: ... illegal variable names ... That is a very poor description. Something can either be used as a variable name or not. abc can be used as a variable name, if can't. But it can be used as a variable name in so

Re: [Tutor] Parentheses and tuples [was Re: Fwd: Difference between types]

2013-05-24 Thread Devin Jeanpierre
On Fri, May 24, 2013 at 10:35 PM, Steven D'Aprano wrote: > So single-item tuples are not special. They just follow the rules for > multiple-item tuples, except that you only have item. And except that the trailing comma is not optional. So, they are special after all. -- Devin __

[Tutor] Parentheses and tuples [was Re: Fwd: Difference between types]

2013-05-24 Thread Steven D'Aprano
On 25/05/13 04:53, Albert-Jan Roskam wrote: Why do I need to use a trailing comma to create a singleton tuple? Without a comma it seems to mean "parenthesized single object", ie the parentheses are basically not there. Because round brackets are also used for grouping. You can group any exp

Re: [Tutor] keyboard interrupt

2013-05-24 Thread eryksun
On Fri, May 24, 2013 at 10:19 PM, Steven D'Aprano wrote: > > You can edit *other* people's questions and answers??!??!?? > > What. The. Hell. This should be done sparingly for answers. But it's very common for questions since inexperienced users almost always get the markdown wrong. _

Re: [Tutor] keyboard interrupt

2013-05-24 Thread Robert Sjoblom
On 25 May 2013 04:19, Steven D'Aprano wrote: > You can edit *other* people's questions and answers??!??!?? > > What. The. Hell. Yes; I think that the idea is that it allows people to fix spelling errors and/or reference mistakes, or maybe add things to clarify something that the answer glossed ov

Re: [Tutor] keyboard interrupt

2013-05-24 Thread Steven D'Aprano
On 25/05/13 01:11, Marc Tompkins wrote: I love, love, love StackOverflow (and the whole StackExchange ecosystem), but it's unfortunately susceptible to being gamed. Anyone can edit a question (or an answer), and if the edit is allowed to stand the editor gets 2 points. You can edit *other* p

Re: [Tutor] making a random list, then naming it

2013-05-24 Thread eryksun
On Fri, May 24, 2013 at 9:10 PM, Dave Angel wrote: > > Is lists[(3,8)] really so much harder to type than > list_3_8 ? Since a comma creates a tuple, in this context you can just use lists[3,8] to save a couple more keystrokes. >>> from random import Random >>> randint = Random(42)

Re: [Tutor] making a random list, then naming it

2013-05-24 Thread Dave Angel
On 05/24/2013 09:35 PM, Jim Mooney wrote: On 24 May 2013 18:10, Dave Angel wrote: Is lists[(3,8)] really so much harder to type than list_3_8 ? You have a point. I hate underlines - my finger always misses them. Keyboards were not designed for programming ;') Anyway, I just thought

Re: [Tutor] making a random list, then naming it

2013-05-24 Thread Jim Mooney
On 24 May 2013 18:10, Dave Angel wrote: > Is lists[(3,8)] really so much harder to type than > list_3_8 ? > You have a point. I hate underlines - my finger always misses them. Keyboards were not designed for programming ;') Anyway, I just thought I'd try exec, but it's giving me fits putt

Re: [Tutor] making a random list, then naming it

2013-05-24 Thread Dave Angel
On 05/24/2013 08:04 PM, Jim Mooney wrote: You forgot to give the author attribution on the following paragraph. I happen to recognize my own text, but that's not a nice thing to do. Notice above where it says "Jim Mooney wrote" ? The short answer is that Python is not designed to be able t

Re: [Tutor] making a random list, then naming it

2013-05-24 Thread Jim Mooney
> The short answer is that Python is not designed to be able to do such a > thing. You're advised instead to make a dictionary, where the key is the > name you generate I was probably unclear what I wanted to do. Basically, enter a string of number pairs of lengths and maxvals to create and prin

Re: [Tutor] challenge-chapter 2

2013-05-24 Thread bob gailer
On 5/22/2013 1:02 AM, Andrew Triplett wrote: ... illegal variable names ... That is a very poor description. Something can either be used as a variable name or not. abc can be used as a variable name, if can't. I defy you to give me a variable name that is illegal! Anything you attempt to gi

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread Dave Angel
On 05/24/2013 02:53 PM, Albert-Jan Roskam wrote: A tuple is defined by commas, depending on context. However, parentheses are typically required because commas have low precedence. >>> 1, 2 + 3, 4 (1, 5, 4) >>> (1, 2) + (3, 4) (1, 2, 3, 4) An empty tuple is a special cas

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread Albert-Jan Roskam
> A tuple is defined by commas, depending on context. However, > parentheses are typically required because commas have low precedence. > >     >>> 1, 2 + 3, 4 >     (1, 5, 4) > >     >>> (1, 2) + (3, 4) >     (1, 2, 3, 4) > > An empty tuple is a special case: > >     >>> x = () >     >>> typ

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread Citizen Kant
It's perfect, even if I'm not able to understand everything that's stated there. Then 2.5 is Operators, and 2.6 is Delimiters, that also goes in the line of what I'm thinking about. Thanks for the "you seem to be talking about", coz I'm learning not by memory but trying to understand, and sometime

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread eryksun
On Fri, May 24, 2013 at 12:52 PM, Citizen Kant wrote: > They are values since they cannot be reduced by rewriting any further. You seem to be talking about the "atoms" of the language: identifiers, literals, parenthesized forms, displays, and so on. Please read sections 2.3 (identifiers), 2.4 (li

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread eryksun
On Fri, May 24, 2013 at 7:04 AM, Citizen Kant wrote: > Same happens with the tuple (100, 'value', 2); where parenthesis and semi > colon work as a rule, setting the shape of a value named tuple that's > different to the shape of a value named list. At the same time both shapes > are equal (since

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread Citizen Kant
When I say "coding", anyone can think about what coding is in his own daily work, but that's not my way. I'll try to refine the concept: right now I'm learning, if I say "coding" I refer to what I type inside my file named learningpythoncode.py that, believe it or not, starts with: # """After the

Re: [Tutor] keyboard interrupt

2013-05-24 Thread Marc Tompkins
On Thu, May 23, 2013 at 3:52 PM, Steven D'Aprano wrote: > On 24/05/13 06:37, Jim Mooney wrote: > >> Apparently Wing isn't as savvy as IDLE when it comes to communicating >>> with the subprocess. I've only searched for about a minute, but >>> apparently the way this works in Wing is to "Restart She

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread eryksun
On Fri, May 24, 2013 at 9:31 AM, Citizen Kant wrote: > Sorry. I'm not doing this on purpose, but I'm doing it anyway, so I'll check > how to fix it. You're replying with rich text, for which Gmail has a lot of its own custom CSS (e.g. the gmail_quote class). In Gmail I see the quoted text as a pu

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread Citizen Kant
Sorry. I'm not doing this on purpose, but I'm doing it anyway, so I'll check how to fix it. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread Steven D'Aprano
Citizen Kant, will you please fix your email quoting? As it is, you are plagiarizing me, by quoting me word for word without attribution or any hint that you are quoting me. Do you notice that everyone else quotes people by name, and prefixes their words with > quote marks? This is the normal

Re: [Tutor] Issue w/ program: Flip a coin and count heads and tails

2013-05-24 Thread Asokan Pichai
On Fri, May 24, 2013 at 4:54 PM, Rafael Knuth wrote: > I am writing a program in Python 3.3.0 which flips a coin 10 x times and >> then counts the number of heads and tails. It obviously does something else >> than I intended, and I am wondering what I did wrong: >> > > What is that you intended?

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread Dave Angel
On 05/24/2013 07:04 AM, Citizen Kant wrote: Are you referring to this definition? http://en.wikipedia.org/wiki/**Value_%28computer_science%29 Any chance you can fix your use of gmail to conform to the usual standards? It does it rig

Re: [Tutor] Issue w/ program: Flip a coin and count heads and tails

2013-05-24 Thread Wolfgang Maier
On 24 May 2013 12:01, Rafael Knuth gmail.com> wrote: > Hello, > > I am writing a program in Python 3.3.0 which flips a coin 10 x times and > then counts the number of heads and tails. It obviously does something else > than I intended, and I am wondering what I did wrong: > > import random > > pri

Re: [Tutor] Issue w/ program: Flip a coin and count heads and tails

2013-05-24 Thread Omar Abou Mrad
On Fri, May 24, 2013 at 2:08 PM, Asokan Pichai wrote: > > > Is this an actual output??? Did the program stop here at 5 heads and 7 > tails? > > Asokan Pichai > > Adding fuel to fire. He actually got 12 Tails and 8 Heads! ___ Tutor maillist - Tutor@p

Re: [Tutor] Issue w/ program: Flip a coin and count heads and tails

2013-05-24 Thread Rafael Knuth
> > I am writing a program in Python 3.3.0 which flips a coin 10 x times and > then counts the number of heads and tails. It obviously does something else > than I intended, and I am wondering what I did wrong: > What is that you intended? Please explain that. I want that program to flip a coin 1

Re: [Tutor] Issue w/ program: Flip a coin and count heads and tails

2013-05-24 Thread Asokan Pichai
On Fri, May 24, 2013 at 4:31 PM, Rafael Knuth wrote: > Hello, > > I am writing a program in Python 3.3.0 which flips a coin 10 x times and > then counts the number of heads and tails. It obviously does something else > than I intended, and I am wondering what I did wrong: > What is that you inten

Re: [Tutor] Issue w/ program: Flip a coin and count heads and tails

2013-05-24 Thread Bod Soutar
On 24 May 2013 12:01, Rafael Knuth wrote: > Hello, > > I am writing a program in Python 3.3.0 which flips a coin 10 x times and > then counts the number of heads and tails. It obviously does something else > than I intended, and I am wondering what I did wrong: > > import random > > print (""" > >

[Tutor] Fwd: Difference between types

2013-05-24 Thread Citizen Kant
Are you referring to this definition? http://en.wikipedia.org/wiki/**Value_%28computer_science%29 As far as it goes, that's not an unreasonable rule of thumb, but it isn't bullet-proof. What, for example, do you make of this: 0x09 Is th

[Tutor] Issue w/ program: Flip a coin and count heads and tails

2013-05-24 Thread Rafael Knuth
Hello, I am writing a program in Python 3.3.0 which flips a coin 10 x times and then counts the number of heads and tails. It obviously does something else than I intended, and I am wondering what I did wrong: import random print (""" This program flips a coin 10 times. It then counts the numb