Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78897
| From | alister <alister.nospam.ware@ntlworld.com> |
|---|---|
| Subject | Re: Practice question |
| Newsgroups | comp.lang.python |
| References | <h2j33adothf9uctcdp5psqk2cclr01961r@4ax.com> <m0vglt$ppq$1@dont-email.me> <tdi63a55gqc3lr6g8mff4qrk8ie9n9i3m9@4ax.com> |
| Message-ID | <TQxZv.411104$J62.399570@fx03.am4> (permalink) |
| Organization | virginmedia.com |
| Date | 2014-10-09 15:28 +0000 |
On Mon, 06 Oct 2014 22:06:09 -0400, Seymore4Head wrote: > On Tue, 7 Oct 2014 01:46:37 +0000 (UTC), Denis McMahon > <denismfmcmahon@gmail.com> wrote: > >>On Sun, 05 Oct 2014 19:02:31 -0400, 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. >> >>I think part of the problem here is that you don't understand the >>expression. >> >>The expression: >> >>15 <= x < 30 >> >>contains two conditions: >> >>15 <= x >> >>x < 30 >> >>For the whole expression to be true, both conditions must be true, hence >>the equivalence is: >> >>(15 <= x) and (x < 30) >> >>to test this in python command line, see if the two different >>expressions give the same result for a suitable range of values of x: >> >>for x in range(50): >> if not (15 <= x < 30) == ((15 <= x) and (x < 30)): >> print "discrepancy" >> >>or >> >>for x in range(50): >> if (15 <= x < 30) == ((15 <= x) and (x < 30)): >> print "ok" > > All of the practice questions up to this question had 4 answers. With > each question you could verify the correct answers by just copy and > pasting each choice into Python. > > So when the instructions said I could verify this with Python I assumed > there might be some way to test if the question was == to each answer. no you need to type in each snippet of code & see if they give the same result when run. -- In every non-trivial program there is at least one bug.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
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
csiph-web