Re: [Tutor] Floating point exercise 3 from Learn python the hard way

2011-06-14 Thread amt
Everything is clear now. Thank you for your replies. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Floating point exercise 3 from Learn python the hard way

2011-06-14 Thread Sander Sweers
On 14 June 2011 15:20, amt <0101...@gmail.com> wrote: >>> But I can't understand at line 2 and 3. I mean it makes no difference >>> for me. Saying 30 or 30.0 is the same thing. >>> As well as saying 97 or 97.0. >> >> Precisely, thats why I asked the question. > > As a beginner at line 2 and 3 I see

Re: [Tutor] Floating point exercise 3 from Learn python the hard way

2011-06-14 Thread Lisi
I too am working through Learn Python the Hard Way. On Tuesday 14 June 2011 14:20:43 amt wrote: > sadly the author of the > book doesn't provide the solutions to the exercises. He gives the answers to the questions in the main block of the chapter, just not for the extra credit questions. I hav

Re: [Tutor] Floating point exercise 3 from Learn python the hard way

2011-06-14 Thread amt
On Tue, Jun 14, 2011 at 12:27 AM, Alan Gauld wrote: > > I can understand why at line 5 I use floating point. 6,75 is more >> precise than saying 7. >> > > Exactly, no problem with line 5 (except the odd comment about 6.83) The comment on line 5 was a mistake. > > But I can't understand at lin

Re: [Tutor] Floating point exercise 3 from Learn python the hard way

2011-06-13 Thread Alan Gauld
"amt" <0101...@gmail.com> wrote in message I am honestly confused. I have read the exercise and found three lines that could use the floating point(2,3 and line 5). I can understand why at line 5 I use floating point. 6,75 is more precise than saying 7. Exactly, no problem with line 5 (exc

Re: [Tutor] Floating point exercise 3 from Learn python the hard way

2011-06-13 Thread Walter Prins
Hi, On 13 June 2011 20:28, amt <0101...@gmail.com> wrote: > >> Can you explain your reasoning? Why do you think line 3 needs >> to be changed? Why line 5? > > > Well the exercise says: "Rewrite ex3.py to use floating point numbers so > it’s more accurate (hint: 20.0 is floating point)." > > I am

Re: [Tutor] Floating point exercise 3 from Learn python the hard way

2011-06-13 Thread amt
> > > Can you explain your reasoning? Why do you think line 3 needs > to be changed? Why line 5? Well the exercise says: "Rewrite ex3.py to use floating point numbers so it’s more accurate (hint: 20.0 is floating point)." I am honestly confused. I have read the exercise and found three lines tha

Re: [Tutor] Floating point exercise 3 from Learn python the hard way

2011-06-13 Thread amt
Hello, my version is Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39). The book only talks about Python 2.x. So, how do I solve the exercise? 3. print "Roosters", 100 - 25 * 3 % 4.00 5. print 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4.00 + 6 Is this correct? I'm a bit confused at line 5 because python return

Re: [Tutor] Floating point exercise 3 from Learn python the hard way

2011-06-13 Thread Alan Gauld
"amt" <0101...@gmail.com> wrote 1 print "I will now count my chickens:" 2 print "Hens", 25 + 30 /6 3 print "Roosters", 100 - 25 * 3 % 4 #Output is 97 4 print "Now I will count the eggs:" 5 print 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6 #Output needs to be 6,83 but Python give me 7 6 print "Is it true th

Re: [Tutor] Floating point exercise 3 from Learn python the hard way

2011-06-13 Thread Válas Péter
2011/6/13 amt <0101...@gmail.com> > I came up with: > print "Roosters", 100 - float(25) * 3 % 4 > > This is for line 3 so it is more precised. Is it correct what I did? I don't think so. All the operations in this line are for integers. % means the remainder of the division, so according to the

[Tutor] Floating point exercise 3 from Learn python the hard way

2011-06-13 Thread amt
Hello, I am a python beginner currently learning from "Learn python the hard way". I'm stuck at exercise 3 and I would like if it's possible to get some help so I can move on. Here is the source code: 1 print "I will now count my chickens:" 2 print "Hens", 25 + 30 /6 3 print "Roosters", 100 - 25 *