Mega Menu

Sunday, May 03, 2020

Python - Boolean Check

Any constant can be represented as a boolean value False if its value is zero of any numeric type or empty as defined below.

    eg:
            if test:
                print("Success")
            else:
                print("Failure")
           
    This prints Success if test is not empty and any value greater than 0 (eg: test=4) and false otherwise


                       

No comments:

Post a Comment