[Tutor] check it for me

Farrukh Ali farrukhali2010 at live.com
Sat Dec 22 22:02:10 CET 2012


Hi Tutor,

I am new to python, and a novice in the world of programming, I am learning python from learnpythonthehardway, and now a little bit confused in exercise 3, where the author of the book wants us to rewrite the ex3.py by saying 
Rewrite ex3.py to use floating point numbers so it’s more accurate (hint: 20.0 is floating point).

so I have written the source code in this manner using floating points, here it is:

 

print "I will now count my chickens:"


print "Hens",25+30.0/6


print "Roosters",100 - 25.0 * 3.0 % 4


print "Now I will count the eggs:"


print 3+2+1-5.0+4.0%2-1/4.0+6

 

print "Is it true that 3+2<5-7?"

 

print 3+2<5-7

 

print "What is 3+2?",3+2
print "What is 5-7?",5-7

 

print "Oh, that's why it's False."

 

print "How about some more."

 

print "Is it greater?", 5>-2

 

print "Is it greater or equal?", 5>=-2
print "Is it less or equal?", 5<=-2

 

print 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6


 

kindly check that whether I have done right?

 

thanks a lot

waiting for ur reply

Sent from Windows Mail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20121222/9c0e1737/attachment.html>


More information about the Tutor mailing list