Popcorn Hack 1: Predicting Outcome

Prediction: Since is_weekday = True then the if statement homework_finished will be ran. Since home_finished is False, the code print(“Finish homework”) will be printed

Code Runner Challenge

Popcorn Hack 1 Prediction

View IPYNB Source
%%python

# CODE_RUNNER: Popcorn Hack 1 Prediction

is_weekday = True
homework_finished = False

if is_weekday:
    if homework_finished:
        print("Free time")
    else:
        print("Finish homework")
else:
    print("Weekend plan")
Lines: 1 Characters: 0
Output
Click "Run" in code control panel to see output ...

Popcorn Hack 2: Repair Student Account

Code Runner Challenge

Popcorn Hack 2

View IPYNB Source
%%python

# CODE_RUNNER: Popcorn Hack 2

lunch_packed = True
practice_after_school = False

if lunch_packed:
    if practice_after_school:
        print("Bring snack")
    else:
        print("Don't bring snack")
else:
    print("No snack available")
    pass

Lines: 1 Characters: 0
Output
Click "Run" in code control panel to see output ...

Popcorn Hack 3: Lunch and Sports Practice (Advanced)

Code Runner Challenge

Popcorn Hack 3

View IPYNB Source
%%python

# CODE_RUNNER: Popcorn Hack 3


lunch_packed = True
practice_after_school = False

if lunch_packed:
    if practice_after_school:
        print("Bring snack")
    else:
        print("Don't bring snack")
else:
    print("No snack available")
    pass

Lines: 1 Characters: 0
Output
Click "Run" in code control panel to see output ...

Homework Hack: High School Daily Routine Dashboard

Code Runner Challenge

Homework Hack

View IPYNB Source
%%python

# CODE_RUNNER: Homework Hack 

student = {
    "logged_in": True,
    "homework_finished": False,
    "lunch_packed": True,
    "practice_today": True
}

# Write your complete nested conditional below.
# Do not delete the starter data. Test several value combinations.
if student["logged_in"]:
    if student["homework_finished"]:
        if student["lunch_packed"]:
            if student["practice_today"]:
                print("nothing to do today!")
            else:
                print("Go to practice today")
        else:
            print("Need to pack lunch")
    else:
        print("Need to finish homework.")
else:
    print("Please log in to access your decision maker.")

Lines: 1 Characters: 0
Output
Click "Run" in code control panel to see output ...