Calculate Drexel Basketball Playerโ€™s Game Stats! ๐Ÿ€

# You must make sure to run all cells in sequence using shift + enter or you might encounter errors
from pykubegrader.initialize import initialize_assignment

responses = initialize_assignment("1_quiz", "week_1", "quiz", assignment_points = 16.0, assignment_tag = 'week1-quiz')

# Initialize Otter
import otter
grader = otter.Notebook("1_quiz.ipynb")

Calculate Drexel Basketball Playerโ€™s Game Stats! ๐Ÿ€#

You are a Drexel Dragons basketball player tracking their performance over the season. You want to calculate how many points youโ€™ve scored and how many points you need to achieve your target for the season!

  • Player ID: Your Drexel ID (the first part of your email address).

  • The you have played 15 games, scoring an average of 20 points per game.

  • The you have also scored 25 bonus points in overtime games.

  • The your season target is to score 400 points.

Using Python, write a program to calculate:

  1. The total points scored by the player so far.

  2. The remaining points needed to reach their season target.

Detailed Instructions#

  1. Define Player ID:

    • Create a variable drexel_id and assign it the value of your drexel_id โ€“ this is the first part of your email. For example, if your email is abc123@drexel.edu, your drexel_id would be abc123. Note that the drexel_id should be a string, you can use single or double quotes to define it. For example, drexel_id = 'abc123' or drexel_id = "abc123" are both valid.

  2. Define the Number of Games and Bonus Points:

    • Create a variable games_played and assign it the value 15.

    • Create a variable average_points and assign it the value 20.

    • Create a variable bonus_points and assign it the value 25.

    • Create a variable season_target and assign it the value 400.

  3. Calculate the Total Points:

    • Multiply the number of games by the average points and save it to total_game_points.

    • Add the bonus points to get the total points scored so far, saved as total_points.

  4. Calculate Remaining Points:

    • Subtract the total points scored from the season target to determine the remaining points needed.

  5. Print the Results:

    • Use f-strings to display the player ID, total points scored, and remaining points needed. We have provided this code for you so you do not have to write it.

# Player's ID
player_id = ...

# Variables

# Number of games played
...

# Average points per game
...

# Bonus points from overtime
...

# Season target
...

# Calculate total points
...

# Calculate remaining points
...

# DO NOT MODIFY BELOW THIS LINE
# Print the results
print(f"Player ID: {player_id}")
print(f"Total Points Scored: {total_points}")
print(f"Remaining Points to Reach Target: {remaining_points}")
grader.check("quiz-1-Drexel-basketball")

๐ŸŽ‰ Well Done!#

Congratulations on completing the Drexel Basketball Playerโ€™s Game Stats Calculation! You are one step closer to achieving your season target! ๐Ÿ€

Submitting Assignment#

Please run the following block of code using shift + enter to submit your assignment, you should see your score.

from pykubegrader.submit.submit_assignment import submit_assignment

submit_assignment("week1-quiz", "1_quiz")