In Python, the True Boolean value is equivalent to the integer 1, and False is equivalent to 0. Therefore, when you multiply True by any number, it's like multiplying 1 by that number.
In this code: print(True * 10)
It will output 10 because True is equivalent to 1, and 1 * 10 equals 10.
0 Comments:
Post a Comment