Boolean - 3.2.8

print("print(10 > 9):", 10 > 9)
print("print(10 == 9):", 10 == 9)
print("print(10 < 9):", 10 < 9)

a = 200
b = 33
# Booleans are data abstractions because they are used to represent truth value. They allow the flow of programs and conditional statements, while hiding the underlying workings of the function.
print("\na is 200, b is 33")

if b > a:
  print("b is greater than a")
else:
  print("b is not greater than a")

#Almost any value is evaluated to True if it has some sort of content.
#Any string is True, except empty strings.
#Any number is True, except 0.
#Any list, tuple, set, and dictionary are True, except empty ones.
print("\nabc:", bool("abc"))
print("123:", bool(123))
print("[]:", bool([]))
print("[apple, cherry, banana]:", bool(["apple", "cherry", "banana"]))
print(10 > 9): True
print(10 == 9): False
print(10 < 9): False

a is 200, b is 33
b is not greater than a

abc: True
123: True
[]: False
[apple, cherry, banana]: True

Javascript

console.log(10 > 9);
console.log(10 == 9);
console.log(10 < 9);

var a = 200;
var b = 33;

if (b > a) {
    console.log("b is greater than a")
} else {
    console.log("a is greater than b")
}

console.log(Boolean("abc"))
console.log(Boolean(123))
console.log(Boolean([]))
console.log(Boolean(["apple", "cherry", "banana"]))

  Cell In[1], line 5
    var a = 200;
        ^
SyntaxError: invalid syntax