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 ")’.

  • ∟⊔⊤∦∣≶@lemmy.nz
    link
    fedilink
    arrow-up
    2
    arrow-down
    2
    ·
    10 months ago

    I’m a little rusty, but can’t you do it with a ‘?’

    something like,

    var ? print(“true”) : print(“false”)

    • scubbo@lemmy.ml
      link
      fedilink
      arrow-up
      2
      ·
      10 months ago

      I think you’re thinking of JavaScript, not Python. The closest thing Python has to a ternary operator is foo if condition else bar.