Lesson 2 ๐Ÿ‘‰ Conditionals

โณ Datatypes Review

So far weโ€™ve seen data in 3 forms:

Datatype Example Explanation
Numbers yourAverage = 3.8 Integers or floats
Strings myName = "Ben" Anything inside โ€œquotesโ€
Booleans isItSaturday = False true or false

โœ Conditionals

Conditional (n) : a statement that is true IF something else is true โ€œIfโ€ฆthenโ€ฆโ€ statements

In programming:
If this functions, do _____
**Else**, do __
___

In life: If you do your homework, then you will earn a high grade.
Else, you will earn a low grade.

What do conditionals require in order to function?

if #something true:
    # run this code
else:
    #run this code

Booleans!

"""
What will print after each conditional is run?
"""
# Number 1:
if 5<2:
    print "I am right"
else:
    print "I am wrong"

    # Number 2:
if 5>2:
    print "I am right"
else:
    print "I am wrong"

Comparators

Comparison Symbol
Equal to ==
Not equal to !=
Less than <
Less than or equal to <=
Greater than >
Greater than or equal to >=