# 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:
The total points scored by the player so far.
The remaining points needed to reach their season target.
Detailed Instructions#
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 isabc123@drexel.edu
, yourdrexel_id
would beabc123
. Note that thedrexel_id
should be a string, you can use single or double quotes to define it. For example,drexel_id = 'abc123'
ordrexel_id = "abc123"
are both valid.
Define the Number of Games and Bonus Points:
Create a variable
games_played
and assign it the value15
.Create a variable
average_points
and assign it the value20
.Create a variable
bonus_points
and assign it the value25
.Create a variable
season_target
and assign it the value400
.
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
.
Calculate Remaining Points:
Subtract the total points scored from the season target to determine the remaining points needed.
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")