posted message: i do excercise 3, extra credit 4: floating point. i just wrote the number as 3.0, 4.0 and so on and got my fractions. however this seems like a complicated solution. i read about //, import division and float (number) but didn t get the differences between those. can anyone explain?

• Youl should see a difference if you use the floating point in line 8.

If you write

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

it prints 7.

But if you use

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

the answer is 6.75, because python now knows it has to stop round up and down. Then it gives you the exact solution.

• thanks, i saw that difference but i was wondering if there is an easier solution than writing the numbers as 4.0, etc. i wasn t quite sure what the point (no pun intended) of the exercise was? to find out that you can write numbers as 4.0? or o find a piece of code that does it for me?

• I think it's just to see that python only prints gives round numbers by default and that you have to force it to do otherwise.

Of coure there are are other solutions. For example in exercice 5 with %r or %f. I think we just have to be patient :)