Smooth Operator

Time to put your operator knowledge to the test!

Follow the comments and see if you can get it right.

Test Cases

test inequality - Run Test

def test_inequality():
    assert var1 == False

test smoothness - Run Test

def test_smoothness():
    assert complicated == True

test shorthand - Run Test

def test_shorthand():
    assert fav_number == 4815162342 * 2

test in - Run Test

def test_in():
    assert var2 == False

Solution 1

fav_number = 4815162342 
i_love_operators = True
my_spoon = "is too big"

# Use the shorthand to multiply fav_number by 2 and save the result back in fav_number
fav_number *= 2

# Use inequality operators to check if fav_number is less than or equal to 7
# Store the result in var1
var1 = fav_number <= 2

# Use the in keyword to check if the letter n is in my_spoon
# Store the result in var2
var2 = "n" in my_spoon

# Make a big operator expression that checks if var1 is True or if both
# i_love_operators and the opposite of var2 are True 
# Store the result in complicated. Don't forget to use parenthesis
complicated = var1 or (i_love_operators and not var2)

fav_number = 4815162342 i_love_operators = True my_spoon = "is too big" # Use the shorthand to multiply fav_number by 2 and save the result back in fav_number # Use inequality operators to check if fav_number is less than or equal to 7 # Store the result in var1 var1 = ? # Use the in keyword to check if the letter n is in my_spoon # Store the result in var2 var2 = ? # Make a big operator expression that checks if var1 is True or if both # i_love_operators and the opposite of var2 are True # Store the result in complicated. Don't forget to use parenthesis complicated = ?