Can someone explain booleans? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone explain booleans?

im completily new

23rd Jul 2016, 5:04 AM
Amir Ezat
Amir Ezat - avatar
5 Answers
+ 2
it's like int and str, but contains only two values: true or false. human = true marcian = false print("human") OUTPUT: true
23rd Jul 2016, 12:50 PM
Abel Fernando Barros Rodrigues
Abel Fernando Barros Rodrigues - avatar
0
human = true marcian = false print("human") OUTPUT: true ----------------------------- 1) output is human, as " " are used in the print function. To print a variable no " " need to be used. In this case just print(human). And the output will be True. 2) True and False must start with capital letters otherwise you will get an error: true/false not declared. Anyway booleans are often used to determine if a statement is true or false. Further on it can be used when user is logging in to system for example. To see if password is correct or not. :) and so on...
2nd Aug 2016, 1:49 PM
Laura
Laura - avatar
- 1
thank you so much, got it now :))
23rd Jul 2016, 2:26 PM
Amir Ezat
Amir Ezat - avatar
- 1
boolean like binary has only two values..true and false while binary has one and two
24th Jul 2016, 7:17 AM
Akshay Jain A
Akshay Jain A - avatar
- 1
Binary has 0 and 1.
24th Jul 2016, 12:30 PM
Abel Fernando Barros Rodrigues
Abel Fernando Barros Rodrigues - avatar