HW HACK 1

# define a list of grades
classGrades = [55, 67, 72, 78, 83, 85, 81, 44, 90, 97, 93, 96, 100]

# make sure all grades are sorted so we can calculate median effectively
classGrades.sort()

#  define length of list so we can divide it and find median
g = len(classGrades)

if g % 2 == 0:
    # to find median when length of classGrades is even you find the two middle values and average them
    median = (classGrades[g // 2 - 1] + classGrades[g // 2]) / 2
else:
    # to find median value when the length is odd you just find the middle value
    median = classGrades[g // 2]

print("Median:", median)
Median: 83

HW HACK 2

import random

#define a random num 1-10
number = random.randint(1,10)

#get user input for num
guess = int(input("Guess a number from 1-10:"))

# check if guess was right
if guess == number:
    print(f"You're correct! You picked {number}.")
else:
    print(f"Wrong! The number was {number}")
You're correct!