Brotherly@lemm.eetoAsklemmy@lemmy.ml•in python, how do i check if an user boolean input is true or false
5·
1 year agoWorth 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.
I’m not a cmd prompt expert, but does
ren *.(current extension name) *
work?
To test it, make a new directory and create 2 files there with the same extension. Then, run that code in that directory and check the result.