IsSnowing = False
result = not(IsSnowing)
print(result)
True
grade = 80

# Has to be between 70 and 100

if grade > 70 and grade <= 100:
    print("You passed the quiz")
You passed the quiz

Logical Operator

  • A logical operator is a symbol or word used to connect two or more expressions Selection
  • A statement that affects the sequence of control by executing certain statements depending on the value of a boolean (true or false).
  • A specific task that is completed with the use of instructions Conditional Statement / If-Statement:
  • The specific block of code that will execute depending on the algorithm condition returning true or false. Algorithm
BasketballMinutesPlayed = 48

if BasketballMinutesPlayed > 48 and grade <=80:
    print("you played the full basketball game, congradulations!")
else:
    print("You need to train more")

# Adding another variation to the hack
You need to train more
import random
result = "Your random number is 27"

a_list = [27, 32, 96,]
random.shuffle(a_list)

a_list[0]

if a_list == 27:
    print(result)
else:
    print(result)
Your random number is 27
import random
a=random.randint(1,100)
print(a)
40