Skip to the content.
3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 JS for Loops and Sprites

Big Idea 3.5 Hacks

In this lesson, I learned about booleans, and how they could be used for rational or logical operations. Like for comparing strings or numbers.

#1 
a = True
b = False
if a:
    print("a is true")
else:
    print("a is false")

if b:
    print("b is true")
else:
    print("b is false")

#2
num = int(input("Please enter a number: "))
if num > 10:
    print(num, "is greater than 10")
elif num < 10:
    print(num, "is less than 1")
else:
    print("Not a number")

#3
num = int(input("please enter a three digit number: "))
if num >= 100 and num <= 999:
    print(num, "is three digits")
else:
    print(num, "is not three digits")
#Python
list = [True, False]
print("A    B    Result")
for i in list:
    for j in list:
        print(i, j, i and j)