test_grades = [85, 92, 78, 95, 88, 91, 89, 79, 96, 83]
test_grades.sort()
num_grades = len(test_grades)
if num_grades % 2 == 0:
median = (test_grades[num_grades // 2 - 1] + test_grades[num_grades // 2]) / 2
else:
median = test_grades[num_grades // 2]
print("Median Test Grade:", median)
##Simple Game
import random
# Generate a random number between 1 and 100
random_number = random.randint(1, 100)
# Number of attempts allowed
attempts = 0
print("Welcome to the Guessing Game!")
print("I'm thinking of a number between 1 and 100. Can you guess it?")
while True:
# Ask the player to guess the number
guess = int(input("Enter your guess: "))
attempts += 1
# Check if the guess is correct
if guess == random_number:
print("Congratulations! You guessed the number in", attempts, "attempts.")
break
elif guess < random_number:
print("Too low! Try again.")
else:
print("Too high! Try again.")