Skip to content

Instantly share code, notes, and snippets.

@junetech
Created December 4, 2020 02:40
Show Gist options
  • Save junetech/2001664bffd82a7639c1f9224dd660a2 to your computer and use it in GitHub Desktop.
Save junetech/2001664bffd82a7639c1f9224dd660a2 to your computer and use it in GitHub Desktop.
Python if statement test
def if_bool_value(any_input):
_str = f"For if statement, {any_input} of {type(any_input)} is"
if any_input:
print(_str, True)
else:
print(_str, False)
if_bool_value(1)
if_bool_value(2)
if_bool_value(0)
if_bool_value("False")
if_bool_value("")
if_bool_value([False])
if_bool_value(list())
if_bool_value(tuple())
if_bool_value(dict())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment