Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78726 > unrolled thread
| Started by | Seymore4Head <Seymore4Head@Hotmail.invalid> |
|---|---|
| First post | 2014-10-05 19:02 -0400 |
| Last post | 2014-10-09 15:28 +0000 |
| Articles | 20 on this page of 27 — 12 participants |
Back to article view | Back to comp.lang.python
Practice question Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-05 19:02 -0400
Re: Practice question Roy Smith <roy@panix.com> - 2014-10-05 19:06 -0400
Re: Practice question Ned Batchelder <ned@nedbatchelder.com> - 2014-10-05 19:14 -0400
Re: Practice question Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-05 20:07 -0400
Re: Practice question Ned Batchelder <ned@nedbatchelder.com> - 2014-10-05 21:25 -0400
Re: Practice question Steven D'Aprano <steve@pearwood.info> - 2014-10-07 08:41 +0000
Re: Practice question Skip Montanaro <skip.montanaro@gmail.com> - 2014-10-05 18:33 -0500
Re: Practice question Rustom Mody <rustompmody@gmail.com> - 2014-10-05 19:47 -0700
Re: Practice question Skip Montanaro <skip.montanaro@gmail.com> - 2014-10-06 08:04 -0500
Re: Practice question Rustom Mody <rustompmody@gmail.com> - 2014-10-06 09:23 -0700
Re: Practice question Chris Angelico <rosuav@gmail.com> - 2014-10-07 03:52 +1100
Re: Practice question Rustom Mody <rustompmody@gmail.com> - 2014-10-06 10:05 -0700
Re: Practice question Chris Angelico <rosuav@gmail.com> - 2014-10-07 04:13 +1100
Re: Practice question Steven D'Aprano <steve@pearwood.info> - 2014-10-06 20:49 +0000
Re: Practice question "Redge @ Versalytics.com" <versalytics@gmail.com> - 2014-10-06 20:54 -0400
Re: Practice question Rustom Mody <rustompmody@gmail.com> - 2014-10-08 09:14 -0700
Re: Practice question Chris Angelico <rosuav@gmail.com> - 2014-10-09 03:23 +1100
Re: Practice question Skip Montanaro <skip.montanaro@gmail.com> - 2014-10-08 11:27 -0500
Re: Practice question Rustom Mody <rustompmody@gmail.com> - 2014-10-08 09:41 -0700
Re: Practice question Terry Reedy <tjreedy@udel.edu> - 2014-10-05 19:47 -0400
Re: Practice question Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-05 20:18 -0400
Re: Practice question Steven D'Aprano <steve@pearwood.info> - 2014-10-07 08:48 +0000
Re: Practice question C Smith <illusiontechniques@gmail.com> - 2014-10-07 05:43 -0700
Re: Practice question C Smith <illusiontechniques@gmail.com> - 2014-10-05 16:24 -0700
Re: Practice question Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-07 01:46 +0000
Re: Practice question Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-06 22:06 -0400
Re: Practice question alister <alister.nospam.ware@ntlworld.com> - 2014-10-09 15:28 +0000
Page 1 of 2 [1] 2 Next page →
| From | Seymore4Head <Seymore4Head@Hotmail.invalid> |
|---|---|
| Date | 2014-10-05 19:02 -0400 |
| Subject | Practice question |
| Message-ID | <h2j33adothf9uctcdp5psqk2cclr01961r@4ax.com> |
For the record, I don't want a hint. I want the answer. I see a practice question is similar to this. 15 <= x < 30 And it wants a similar expression that is equivalent. So the right answer is 15<= x or x <30 but one of the other answers is not (15<= x and x <30) But it says.....remember you can try this out in the Python shell. How?
[toc] | [next] | [standalone]
| From | Roy Smith <roy@panix.com> |
|---|---|
| Date | 2014-10-05 19:06 -0400 |
| Message-ID | <roy-FA7028.19060105102014@news.panix.com> |
| In reply to | #78726 |
In article <h2j33adothf9uctcdp5psqk2cclr01961r@4ax.com>, Seymore4Head <Seymore4Head@Hotmail.invalid> wrote: > For the record, I don't want a hint. I want the answer. 42.
[toc] | [prev] | [next] | [standalone]
| From | Ned Batchelder <ned@nedbatchelder.com> |
|---|---|
| Date | 2014-10-05 19:14 -0400 |
| Message-ID | <mailman.14619.1412550882.18130.python-list@python.org> |
| In reply to | #78726 |
On 10/5/14 7:02 PM, Seymore4Head wrote: > For the record, I don't want a hint. I want the answer. > I see a practice question is similar to this. > 15 <= x < 30 And it wants a similar expression that is equivalent. > So the right answer is 15<= x or x <30 No, "15 <= x < 30" is equivalent to "15 <= x and x < 30". > but one of the other answers is > not (15<= x and x <30) You are speaking ambiguously. Which did you mean: a) one of the other answers isn't "15 <= x and x < 30", or: b) one of the other answers is "not (15 <= x and x < 30)" ? -- Ned Batchelder, http://nedbatchelder.com
[toc] | [prev] | [next] | [standalone]
| From | Seymore4Head <Seymore4Head@Hotmail.invalid> |
|---|---|
| Date | 2014-10-05 20:07 -0400 |
| Message-ID | <t7n33a1e8ashb73lv4s0nntfe9bvjm6luu@4ax.com> |
| In reply to | #78728 |
On Sun, 05 Oct 2014 19:14:27 -0400, Ned Batchelder <ned@nedbatchelder.com> wrote: >On 10/5/14 7:02 PM, Seymore4Head wrote: >> For the record, I don't want a hint. I want the answer. >> I see a practice question is similar to this. >> 15 <= x < 30 And it wants a similar expression that is equivalent. >> So the right answer is 15<= x or x <30 > >No, "15 <= x < 30" is equivalent to "15 <= x and x < 30". > >> but one of the other answers is >> not (15<= x and x <30) > >You are speaking ambiguously. Which did you mean: >a) one of the other answers isn't "15 <= x and x < 30", or: >b) one of the other answers is "not (15 <= x and x < 30)" ? Here is the exact question, I was trying to post something similar. I failed. http://i.imgur.com/iUGh4xf.jpg
[toc] | [prev] | [next] | [standalone]
| From | Ned Batchelder <ned@nedbatchelder.com> |
|---|---|
| Date | 2014-10-05 21:25 -0400 |
| Message-ID | <mailman.14623.1412558726.18130.python-list@python.org> |
| In reply to | #78731 |
On 10/5/14 8:07 PM, Seymore4Head wrote: > On Sun, 05 Oct 2014 19:14:27 -0400, Ned Batchelder > <ned@nedbatchelder.com> wrote: > >> On 10/5/14 7:02 PM, Seymore4Head wrote: >>> For the record, I don't want a hint. I want the answer. >>> I see a practice question is similar to this. >>> 15 <= x < 30 And it wants a similar expression that is equivalent. >>> So the right answer is 15<= x or x <30 >> >> No, "15 <= x < 30" is equivalent to "15 <= x and x < 30". >> >>> but one of the other answers is >>> not (15<= x and x <30) >> >> You are speaking ambiguously. Which did you mean: >> a) one of the other answers isn't "15 <= x and x < 30", or: >> b) one of the other answers is "not (15 <= x and x < 30)" ? > > Here is the exact question, I was trying to post something similar. I > failed. > > http://i.imgur.com/iUGh4xf.jpg > Why isn't the fourth one correct? -- Ned Batchelder, http://nedbatchelder.com
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve@pearwood.info> |
|---|---|
| Date | 2014-10-07 08:41 +0000 |
| Message-ID | <5433a734$0$2916$c3e8da3$76491128@news.astraweb.com> |
| In reply to | #78731 |
On Sun, 05 Oct 2014 20:07:50 -0400, Seymore4Head wrote: > Here is the exact question, I was trying to post something similar. I > failed. > > http://i.imgur.com/iUGh4xf.jpg Please don't post screen shots if you can avoid it. You almost certainly can copy and paste the text from the web page. And if you can't, you can usually re-type the question. It's good practice to strength your typing skills. Screen shots cannot be read by people using a screen reader, or who don't have access to the web (but are reading their mail), or if the host site (in this case, imgur) is down or blocked. -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Skip Montanaro <skip.montanaro@gmail.com> |
|---|---|
| Date | 2014-10-05 18:33 -0500 |
| Message-ID | <mailman.14620.1412552037.18130.python-list@python.org> |
| In reply to | #78726 |
[Multipart message — attachments visible in raw view] — view raw
On Oct 5, 2014 6:07 PM, "Seymore4Head" <Seymore4Head@hotmail.invalid> wrote:
>
> For the record, I don't want a hint. I want the answer.
> I see a practice question is similar to this.
> 15 <= x < 30 And it wants a similar expression that is equivalent.
Maybe
30 > x >= 15
? Seems more "similar" to the original expression than the other
possibilities.
As to how to try it out, bring up the Python prompt, assign various values
to x, and keep evaluating the possibilities. To simplify evaluation off a
bunch of alternatives, consider defining a function which takes x add a
parameter and print out the various expression values. I'd give a concrete
example, but don't has a prompt available on my phone...
Just my 2¢...
Skip
[toc] | [prev] | [next] | [standalone]
| From | Rustom Mody <rustompmody@gmail.com> |
|---|---|
| Date | 2014-10-05 19:47 -0700 |
| Message-ID | <9e674b54-92e8-469b-ba68-da593fc8564a@googlegroups.com> |
| In reply to | #78729 |
On Monday, October 6, 2014 5:04:11 AM UTC+5:30, Skip Montanaro wrote: > On Oct 5, 2014 6:07 PM, Seymore4Head wrote: > > For the record, I don't want a hint. I want the answer. > > I see a practice question is similar to this. > > 15 <= x < 30 And it wants a similar expression that is equivalent. > Maybe > 30 > x >= 15 > ? Seems more "similar" to the original expression than the other possibilities. > As to how to try it out, bring up the Python prompt, assign various > values to x, and keep evaluating the possibilities. To simplify > evaluation off a bunch of alternatives, consider defining a function > which takes x add a parameter and print out the various expression > values. I'd give a concrete example, but don't has a prompt > available on my phone... An interesting data-point. We have a here a poster who's asked some 20 or so python questions and still seems not to know how to use the interpreter interactively. Sorry Seymore if this sounds condescending -- its not a complaint against you but against those who treat the print statement/expression as kosher for newbies. Imagine someone who has driven a car for a month but has no clue about the basic rule of keep-left (or right).
[toc] | [prev] | [next] | [standalone]
| From | Skip Montanaro <skip.montanaro@gmail.com> |
|---|---|
| Date | 2014-10-06 08:04 -0500 |
| Message-ID | <mailman.14635.1412600656.18130.python-list@python.org> |
| In reply to | #78736 |
On Sun, Oct 5, 2014 at 9:47 PM, Rustom Mody <rustompmody@gmail.com> wrote: > Sorry Seymore if this sounds condescending -- its not a complaint > against you but against those who treat the print statement/expression as > kosher for newbies. So if you're not griping about Seymore's original post, are you griping about my response? It was the one you quoted. And what's with the comparison between use of the print statement and driving on the wrong side of the road? Skip
[toc] | [prev] | [next] | [standalone]
| From | Rustom Mody <rustompmody@gmail.com> |
|---|---|
| Date | 2014-10-06 09:23 -0700 |
| Message-ID | <eb7c4d3d-045e-4f38-bdb1-c26126ea5b12@googlegroups.com> |
| In reply to | #78755 |
On Monday, October 6, 2014 6:34:27 PM UTC+5:30, Skip Montanaro wrote: > On Sun, Oct 5, 2014 at 9:47 PM, Rustom Mody wrote: > > Sorry Seymore if this sounds condescending -- its not a complaint > > against you but against those who treat the print statement/expression as > > kosher for newbies. > So if you're not griping about Seymore's original post, are you > griping about my response? It was the one you quoted. It so happened you were the person to note that here was a question(er) needing instruction about using the interpreter. Nothing wrong with the answer (or the question). Something wrong with the point at which it emerges. > And what's with the comparison between use of the print statement > and driving on the wrong side of the road? Consider the sequence: 1. Drives on the wrong side of the road 2. Has no clue that there's such a concept as 'wrong side of road' 3. Teaches people to drive without conveying anything about 'wrong side of road' Hopefully you will agree that 1 < 2 < 3?? My gripe is with 3
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-10-07 03:52 +1100 |
| Message-ID | <mailman.14648.1412614332.18130.python-list@python.org> |
| In reply to | #78769 |
On Tue, Oct 7, 2014 at 3:23 AM, Rustom Mody <rustompmody@gmail.com> wrote: > Consider the sequence: > > 1. Drives on the wrong side of the road > 2. Has no clue that there's such a concept as 'wrong side of road' > 3. Teaches people to drive without conveying anything about 'wrong side of road' > > Hopefully you will agree that 1 < 2 < 3?? > > My gripe is with 3 No, I don't agree. Teaching people to drive is separate from teaching road rules, which vary by legislature. I can draw the exact same analogy: 1. Fails to follow proper protocol at a hook turn intersection 2. Has no clue that there's such a concept as a hook turn 3. Teaches people to drive without conveying anything about hook turns. Most of you are probably in state 2, and your instructors were probably in state 3. Neither's a problem, because hook turns don't matter until you come to an intersection where they're used. (And even then, there's often signage.) The complaints you're making are about something that does not matter. There are multiple usage patterns for Python; one is to eschew the interactive interpreter and run everything from scripts. That's fine, there's nothing wrong with it. And then, the nuances of interactive Python are completely insignificant. I don't see that your complaints about print and interactive mode have anything at all to do with this thread. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Rustom Mody <rustompmody@gmail.com> |
|---|---|
| Date | 2014-10-06 10:05 -0700 |
| Message-ID | <b3c30cb9-6b04-402c-8adf-fe5a13551679@googlegroups.com> |
| In reply to | #78772 |
On Monday, October 6, 2014 10:22:27 PM UTC+5:30, Chris Angelico wrote: > On Tue, Oct 7, 2014 at 3:23 AM, Rustom Mody wrote: > > Consider the sequence: > > 1. Drives on the wrong side of the road > > 2. Has no clue that there's such a concept as 'wrong side of road' > > 3. Teaches people to drive without conveying anything about 'wrong side of road' > > Hopefully you will agree that 1 < 2 < 3?? > > My gripe is with 3 > No, I don't agree. Interesting So you dont agree with: "1<2<3" ? Or with "My gripe is 3" ? The second would be quite bizarre: "I have a headache..." "Sorry. But I dont agree with that"
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-10-07 04:13 +1100 |
| Message-ID | <mailman.14649.1412615599.18130.python-list@python.org> |
| In reply to | #78773 |
On Tue, Oct 7, 2014 at 4:05 AM, Rustom Mody <rustompmody@gmail.com> wrote: > On Monday, October 6, 2014 10:22:27 PM UTC+5:30, Chris Angelico wrote: >> On Tue, Oct 7, 2014 at 3:23 AM, Rustom Mody wrote: >> > Consider the sequence: >> > 1. Drives on the wrong side of the road >> > 2. Has no clue that there's such a concept as 'wrong side of road' >> > 3. Teaches people to drive without conveying anything about 'wrong side of road' >> > Hopefully you will agree that 1 < 2 < 3?? >> > My gripe is with 3 > >> No, I don't agree. > > Interesting > > So you dont agree with: "1<2<3" ? > > Or with "My gripe is 3" ? > > The second would be quite bizarre: > > "I have a headache..." > > "Sorry. But I dont agree with that" Well, hey, I've eaten things that disagreed with me. You'd think that would be purely factual. "I ate you!" "I disagree!". But no, it was the "1 < 2 < 3" part that I disagreed with... as I'm sure you were aware. Never let the obvious truth of something get in the way of a good joke :) ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve@pearwood.info> |
|---|---|
| Date | 2014-10-06 20:49 +0000 |
| Message-ID | <5433004e$0$2916$c3e8da3$76491128@news.astraweb.com> |
| In reply to | #78773 |
On Mon, 06 Oct 2014 10:05:40 -0700, Rustom Mody wrote: > On Monday, October 6, 2014 10:22:27 PM UTC+5:30, Chris Angelico wrote: >> On Tue, Oct 7, 2014 at 3:23 AM, Rustom Mody wrote: >> > Consider the sequence: >> > 1. Drives on the wrong side of the road 2. Has no clue that there's >> > such a concept as 'wrong side of road' 3. Teaches people to drive >> > without conveying anything about 'wrong side of road' Hopefully you >> > will agree that 1 < 2 < 3?? My gripe is with 3 > >> No, I don't agree. > > Interesting > > So you dont agree with: "1<2<3" ? I can't speak for Chris, by my answer is neither Yes nor No, but Mu. http://en.wikipedia.org/wiki/Mu_%28negative%29#In_popular_culture I don't understand what semantics you are giving the < symbol. It's not "less than", since statements 1, 2 and 3 above don't have a total order or even a partial order. What does it mean to say that "Drives on the wrong side of the road" is less than "Teaches people to drive without conveying anything about 'wrong side of road'"? Less than in what sense? Alphabetical order? Less dangerous? Less competent? Less annoying? Less expensive? So, no, I don't agree. Nor do I disagree. I have fewer issues with your conclusion and analogy than I do with the basic premise that there is a connection between Seymore's problem here and the use, or non-use, of print in the interactive interpreter. I don't see how replacing interactive use and/or the use of print with functions containing return statements would help Seymore. > Or with "My gripe is 3" ? > > The second would be quite bizarre: If it's bizarre, why do you consider that Chris may mean that? The reasonable thing would be to reject it from contention. > "I have a headache..." > > "Sorry. But I dont agree with that" "I don't agree that you have a headache. You're obviously lying, acting, delusional, an insentient robot programmed to repeat the words 'I have a headache', a zombie (not the brain eating kind, the philosophical kind), a sophisticated bot (but not sophisticated enough to pass the Turing test), or otherwise faking it." I'm just sayin'... -- Steven
[toc] | [prev] | [next] | [standalone]
| From | "Redge @ Versalytics.com" <versalytics@gmail.com> |
|---|---|
| Date | 2014-10-06 20:54 -0400 |
| Message-ID | <mailman.14653.1412643284.18130.python-list@python.org> |
| In reply to | #78783 |
> On Oct 6, 2014, at 4:49 PM, Steven D'Aprano <steve@pearwood.info> wrote: > >> On Mon, 06 Oct 2014 10:05:40 -0700, Rustom Mody wrote: >> >>> On Monday, October 6, 2014 10:22:27 PM UTC+5:30, Chris Angelico wrote: >>>> On Tue, Oct 7, 2014 at 3:23 AM, Rustom Mody wrote: >>>> Consider the sequence: >>>> 1. Drives on the wrong side of the road 2. Has no clue that there's >>>> such a concept as 'wrong side of road' 3. Teaches people to drive >>>> without conveying anything about 'wrong side of road' Hopefully you >>>> will agree that 1 < 2 < 3?? My gripe is with 3 >> >>> No, I don't agree. >> >> Interesting >> >> So you dont agree with: "1<2<3" ? > > I can't speak for Chris, by my answer is neither Yes nor No, but Mu. > > http://en.wikipedia.org/wiki/Mu_%28negative%29#In_popular_culture > > > I don't understand what semantics you are giving the < symbol. It's not > "less than", since statements 1, 2 and 3 above don't have a total order > or even a partial order. What does it mean to say that "Drives on the > wrong side of the road" is less than "Teaches people to drive without > conveying anything about 'wrong side of road'"? Less than in what sense? > Alphabetical order? Less dangerous? Less competent? Less annoying? Less > expensive? > > So, no, I don't agree. Nor do I disagree. > > I have fewer issues with your conclusion and analogy than I do with the > basic premise that there is a connection between Seymore's problem here > and the use, or non-use, of print in the interactive interpreter. I don't > see how replacing interactive use and/or the use of print with functions > containing return statements would help Seymore. > > > >> Or with "My gripe is 3" ? >> >> The second would be quite bizarre: > > If it's bizarre, why do you consider that Chris may mean that? The > reasonable thing would be to reject it from contention. > > >> "I have a headache..." >> >> "Sorry. But I dont agree with that" > > > "I don't agree that you have a headache. You're obviously lying, acting, > delusional, an insentient robot programmed to repeat the words 'I have a > headache', a zombie (not the brain eating kind, the philosophical kind), > a sophisticated bot (but not sophisticated enough to pass the Turing > test), or otherwise faking it." > > I'm just sayin'... > > > > -- > Steven > -- > I agree that 1<2<3. From a numerical point of view this is correct. The distraction here is the inference that the numbers somehow relate to the statements preceding this conclusion.
[toc] | [prev] | [next] | [standalone]
| From | Rustom Mody <rustompmody@gmail.com> |
|---|---|
| Date | 2014-10-08 09:14 -0700 |
| Message-ID | <abd0048c-7e59-42a0-9dc6-cc03f7985b8f@googlegroups.com> |
| In reply to | #78783 |
On Tuesday, October 7, 2014 2:19:39 AM UTC+5:30, Steven D'Aprano wrote: > I have fewer issues with your conclusion and analogy than I do with the > basic premise that there is a connection between Seymore's problem here > and the use, or non-use, of print in the interactive interpreter. I don't > see how replacing interactive use and/or the use of print with functions > containing return statements would help Seymore. The issue is not only that print is bad but that the interpreter is good for learning and trying out. Are these two really unconnected. Lets see... One can - use print without the interpreter - use the interpreter without print - use both But can one use neither? [Assuming telepathy/ESP etc is disallowed] So pushing beginners away from print can push them up the learning curve more quickly
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-10-09 03:23 +1100 |
| Message-ID | <mailman.14682.1412785412.18130.python-list@python.org> |
| In reply to | #78840 |
On Thu, Oct 9, 2014 at 3:14 AM, Rustom Mody <rustompmody@gmail.com> wrote: > The issue is not only that print is bad but that the interpreter is > good for learning and trying out. > > Are these two really unconnected. Lets see... One can > > - use print without the interpreter > - use the interpreter without print > - use both > > But can one use neither? [Assuming telepathy/ESP etc is disallowed] > > So pushing beginners away from print can push them up the learning > curve more quickly (Please be more clear with your terminology; running Python scripts is still using the interpreter, it's just not using *interactive* Python. What you're saying above is all about Python's interactive mode.) Your conclusion doesn't obviously follow from your preceding statements. How does pushing people away from print push them up? Which way is "up"? Is it "up" to move from interactive Python to scripts run from the command line? Or is that down? How does the avoidance of print push anyone anywhere, anyway? ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Skip Montanaro <skip.montanaro@gmail.com> |
|---|---|
| Date | 2014-10-08 11:27 -0500 |
| Message-ID | <mailman.14683.1412785639.18130.python-list@python.org> |
| In reply to | #78840 |
On Wed, Oct 8, 2014 at 11:14 AM, Rustom Mody <rustompmody@gmail.com> wrote: > So pushing beginners away from print can push them up the learning > curve more quickly Or more quickly discourage them. I still use print for all sorts of things. In my opinion, there is often no need for fancy loggers, str.format, or the write method of file-like objects. Print will often get you a "good enough" result faster than the other means. Skip
[toc] | [prev] | [next] | [standalone]
| From | Rustom Mody <rustompmody@gmail.com> |
|---|---|
| Date | 2014-10-08 09:41 -0700 |
| Message-ID | <fca98282-ae55-495c-8bc2-b450b1560227@googlegroups.com> |
| In reply to | #78842 |
On Wednesday, October 8, 2014 9:58:11 PM UTC+5:30, Skip Montanaro wrote: > On Wed, Oct 8, 2014 at 11:14 AM, Rustom Mody wrote: > > So pushing beginners away from print can push them up the learning > > curve more quickly > Or more quickly discourage them. I still use print for all sorts of > things. In my opinion, there is often no need for fancy loggers, > str.format, or the write method of file-like objects. Print will often > get you a "good enough" result faster than the other means. Well I'm not talking of people like you!! Nor of more sophisticated tools than print. I am talking of the fact that an absolute basic sine qua non for beginners is to be able to structure programs: - breaking up a complex expression into sub-expressions - abstracting out a sub-expression into a function with an appropriate parameterization - inverses of the above when the current cut is sub-optimal etc etc... what is nowadays fashionably called 'refactoring' And for that the noob needs to learn to write return-ing function where he currently writes a print-ing function.
[toc] | [prev] | [next] | [standalone]
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2014-10-05 19:47 -0400 |
| Message-ID | <mailman.14621.1412552876.18130.python-list@python.org> |
| In reply to | #78726 |
On 10/5/2014 7:02 PM, Seymore4Head wrote:
> For the record, I don't want a hint. I want the answer.
> I see a practice question is similar to this.
> 15 <= x < 30 And it wants a similar expression that is equivalent.
> So the right answer is 15<= x or x <30
> but one of the other answers is
> not (15<= x and x <30)
>
> But it says.....remember you can try this out in the Python shell.
> How?
For instance,
for x in (10, 20, 30, 40):
print((15 <= x < 30) == (15<= x and x <30))
--
Terry Jan Reedy
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.python
csiph-web