• Python question of the day

    What would be the output of executing the following code:
    print(0.0 or 0)
     0
     0.0
     True
     False
    Explanation:
    In python, the general rule is: a and b is b if a is true, else it is a; a or b is a if a is true, else it is b. Now, False, None, (), [], {}, '', 0 and 0.0 are all considered false; practically everything else is true.


    Top 100 python interview questions:


datai analytics