Hack #1

Create a visual or written description that compares lists and dictionaries.

list

Hacks #2

Use sorting algorithms to perform operations on a dictionary/list.

The data below is sorted by which star wars moives made the most money from highest to lowest.

starwarsmovies = {
    'Name': ["The Phantom Menace", "Attack of the Clones", "Revenge of the Sith", "A New Hope", "Empire Strikes Back", "Return of the Jedi", "The Force Awakens", "The Last Jedi", "The Rise of Skywalker"],
    'Audience': [59, 56, 66, 96, 97, 94, 85, 42, 86],
    'Rotten Tomatoes': [51, 65, 79, 93, 94, 83, 93, 91, 52],
    'Duration': [133, 143, 140, 121, 124, 133, 136, 152, 142],
    'money made(millions)':[431, 302, 380, 307, 209, 252, 936, 620, 515]
}

moviesbymoney = sorted(zip(starwarsmovies['Name'], starwarsmovies['money made(millions)']), key=lambda x: x[1], reverse=True)
for movie in moviesbymoney:
    print(f"{movie[0]}: ${movie[1]} million dollars")
The Force Awakens: $936 million dollars
The Last Jedi: $620 million dollars
The Rise of Skywalker: $515 million dollars
The Phantom Menace: $431 million dollars
Revenge of the Sith: $380 million dollars
A New Hope: $307 million dollars
Attack of the Clones: $302 million dollars
Return of the Jedi: $252 million dollars
Empire Strikes Back: $209 million dollars

Hacks #3

Create a simulation that uses a list.

This code simulates how well the crops are based on the weather and time of day.

import random

weather = ['sunny', 'cloudy', 'raining', 'snowing']
time = ['morning', 'afternoon', 'night']
yieldofcrops = {
    ('sunny', 'morning'): 70,
    ('sunny', 'afternoon'): 100,
    ('sunny', 'night'): 60,
    ('cloudy', 'morning'): 65,
    ('cloudy', 'afternoon'): 80,
    ('cloudy', 'night'): 50,
    ('raining', 'morning'): 40,
    ('raining', 'afternoon'): 50,
    ('raining', 'night'): 20,
    ('snowing', 'morning'): 10,
    ('snowing', 'afternoon'): 15,
    ('snowing', 'night'): 5,
}

weathertoday = random.choice(weather)
timenow = random.choice(time)
yieldtoday = yieldofcrops[(weathertoday, timenow)]
if yieldtoday >= 70:
    cropresult = "very good"
elif yieldtoday >= 40:
    cropresult = "good"
elif yieldtoday >= 20:
    cropresult = "bad"
else:
    cropresult = "very bad"

print(f"This {timenow}, the weather was {weathertoday} and the crop yield was {cropresult}.")
This afternoon, the weather was cloudy and the crop yield was very good.

Hacks #4

Kahoot Score: 8/10

list

The Practice AP MCQ Tests have many questions that involve simulations and some that ask about the use of lists and dictionaries. Taking those tests would be a good way to study.