Last answered:

26 Oct 2022

Posted on:

25 Oct 2022

0

Resolved: Why 70_000 and why 255.?

Good morning. Since when we write numbers as 70_000 instead of 70000 and why?
Second question: in the function you write "255.". I guess that it's like writing 255.0, but does it make any difference if we write just 255 instead?
Thank you

1 answers ( 1 marked as helpful)
Instructor
Posted on:

26 Oct 2022

1

Hi Alessandro,

The 70_000 is written like that just so it is easier to read it at a first glance, rather than having to count how many zeros there are. That's the only reason, just readability.
As for the second question - yes, you are correct. We write 255. as to force Python to treat it like a floating point, rather than an integer. It is practically the same as writing 255.0.

Hope this clears it up!

Best,
Nikola, 365 Team

Submit an answer