Value of Boolean | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Value of Boolean

Can I set "False" for "my_boolean"? I tried but it did not change anything.

20th Feb 2017, 3:58 PM
Barış Efe Coşkun
Barış Efe Coşkun - avatar
6 Answers
+ 2
my_boolean=False if my_boolean: print("boolean is True") #this won't be printed if not my_boolean: print("boolean is False") #this will be printed
20th Feb 2017, 9:05 PM
ramzi
ramzi - avatar
+ 1
You may need to show your code.
20th Feb 2017, 4:09 PM
Twelfty
Twelfty - avatar
+ 1
you should check your code you can do what you are trying..
20th Feb 2017, 4:15 PM
Shafiq
Shafiq - avatar
0
give more details or show the code, maybe others can solve your problem
20th Feb 2017, 4:08 PM
Steven Wang
Steven Wang - avatar
0
Hi
20th Feb 2017, 5:14 PM
İdris Sy
İdris Sy - avatar
0
You can make any variable a Boolean variable, you just need to assign "True" or "False" as their value(without inverted commas). Make sure that what you are writing is "False" and not "false" Sample program with output: >>> my_boolean = False >>> if 3 > 4 : >>> print (my_boolean) False
27th Feb 2017, 11:05 AM
Akhil Haridasan
Akhil Haridasan - avatar