import statistics
# List of test grades
test_grades = [85, 92, 78, 90, 88, 76, 94, 89, 81, 87]
# Calculate the median
median_grade = statistics.median(test_grades)
# Print the median test grade
print(f"The median test grade is: {median_grade}")
import random
def guess_the_number():
# Generate a random number between 1 and 100
secret_number = random.randint(1, 100)
# Set the initial number of tries
tries = 0
print("Welcome to the Guess the Number game!")
print("I'm thinking of a number between 1 and 100.")
while True:
# Ask the player to guess the number
guess = int(input("Enter your guess: "))
# Increment the number of tries
tries += 1
# Check if the guess is correct
if guess == secret_number:
print(f"Congratulations! You guessed the number {secret_number} in {tries} tries.")
break
elif guess < secret_number:
print("Too low. Try again.")
else:
print("Too high. Try again.")
if __name__ == "__main__":
guess_the_number()
Welcome to the Guess the Number game!
I'm thinking of a number between 1 and 100.
Too low. Try again.
Too high. Try again.
Too high. Try again.
Too high. Try again.
Congratulations! You guessed the number 6 in 5 tries.