Hacks

AP Classroom. Provide answers and thoughts on theoritical question form college board Video in section 4.3. They start at about the 9 minute mark.

  • Example 1
    • When two of the processes are running in parallel in this example it will take 50 seconds to run. This is because Y and Z are going to run in parallel. Y will take 10 seconds and Z will take thirty seconds. Together this will take forty seconds. The third process will take 50 seconds to run so this would be the mininmum. One processor would be doing Y then Z and one would be doing X. Both the processors would be running at the same time so the one that takes forty second will stop and the whole entire process will stop after 50 seconds when the second process is done.
  • Example 2
    • The difference in time between running these processes in parallel than one after another is 25 seconds. If we run them in parallel they will run at the same time so the longer process will be the execution time. This is 45 seconds. Running them one after another is adding them together which would be 25+45 which is 70. So one process is 70 second and one is 45 seconds. 70-25= 25 seconds.

Data Structures. Build a List Comprehension example

  • list = [calc(item) for item in items]
    • I sorted the 100m times of olympic sprinters, me, and a random character.
One_Hundred_Meter_times = {
    "Runners": {
        "Jake": {
            "PR": 11.14,
        },
        "Usain": {
            "PR": 9.58,
        },
        "Yohan": {
            "PR": 9.68,
        },
        "Noah": {
            "PR": 9.86,
        },
        "Bill": {
            "PR": 13.45,
        }
    }
}

Times = {runner: One_Hundred_Meter_times['Runners'][runner] for runner in One_Hundred_Meter_times['Runners']}

def sort_times(times):
    sorted_times = dict(sorted(times.items(), key=lambda x: x[1]['PR'], reverse=True))
    return sorted_times

sorted_times = sort_times(Times)
print(sorted_times)
{'Bill': {'PR': 13.45}, 'Jake': {'PR': 11.14}, 'Noah': {'PR': 9.86}, 'Yohan': {'PR': 9.68}, 'Usain': {'PR': 9.58}}