
I am not sure if you would classify this as a documentation bug or minor software bug I have been teaching an Introduction to Programming using Python at Lehman College for more than half a dozen years. For the first problem covering "if", I ask the students to write a program where the user is prompted to enter an integer and the program logic determines whether the number is odd or even. I was surprised to see a student submission contain: if number % 2 == int() : #even rather than if number % 2 == 0: #even The Documentation did not say what happens if there was no argument. I though an Exception would be thrown, but "no", int( ) returned a 0 Also float() returns 0.0 Jeff Gitlin Lehman College Bronx, New York

Hi, Actually, https://docs.python.org/3/library/functions.html#int state
Return an integer object constructed from a number or string /x/, or return |0| if no arguments are given.
So it seems that the documentation is consistent with your discovery. Actually, if `int` is a class, your student is calling the constructor with default value, 0 seems a good default. Can you please let us know where you found the documentation bug? From experience documentation has sometime been out of date or contradictory on details, so there may still be something to correct somewhere else Regards, Arthur On 07.11.21 12:55, Jeffrey Gitlin wrote:

Hi, Actually, https://docs.python.org/3/library/functions.html#int state
Return an integer object constructed from a number or string /x/, or return |0| if no arguments are given.
So it seems that the documentation is consistent with your discovery. Actually, if `int` is a class, your student is calling the constructor with default value, 0 seems a good default. Can you please let us know where you found the documentation bug? From experience documentation has sometime been out of date or contradictory on details, so there may still be something to correct somewhere else Regards, Arthur On 07.11.21 12:55, Jeffrey Gitlin wrote:
participants (2)
-
Arthur Milchior
-
Jeffrey Gitlin