There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

This profile is from a federated server and may be incomplete. Browse more on the original instance.

in python, how do i check if an user boolean input is true or false

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

asignz , (edited )

Just use 'strtobool' from distutils to parse str as bool much better than reinventing the wheel https://docs.python.org/3.11/distutils/apiref.html#distutils.util.strtobool

edit: ok it uses if internally so without if you could do it with match statement

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • lifeLocal
  • goranko
  • All magazines