to my knowledge, if you input any text it will return true and if you input nothing it will return false. if it’s possible without if statements, how do i check if they inputted ‘True’ or 'False (/ ‘1’ or ‘0’) when im doing ‘bool(input("Input True or False ")’.

  • Brotherly@lemm.ee
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    1 year ago

    Worth remembering that python uses the concepts of truthy and falsey. Empty string (“”) is falsey. Any other string (“true”, “false”, “0”, etc.) Is truthy. All bool(str) does is evaluate whether str is truthy or falsey. It does not evaluate what str actually is.

    So bool(input("Input True or False ") will return False is the user input is empty and True otherwise.