# 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_practice-quiz", "week_1", "practicequiz", assignment_points = 18.0, assignment_tag = 'week1-practicequiz')
# Initialize Otter
import otter
grader = otter.Notebook("1_practice-quiz.ipynb")
โ Calculating Total Credits at Drexel! ๐#
At Drexel Universityโs College of Engineering, students need to complete multiple co-op cycles and classes. Letโs calculate how many credits a student has completed so far!
Drexel ID:
abx123
The student has taken 10 classes, each worth 3 credits.
The student has also earned 12 additional credits from a co-op experience.
Using Python, write a program to calculate:
The total credits completed by the student.
The remaining credits needed to graduate, assuming the graduation requirement is 180 credits.
Detailed Instructions:#
Define Your Drexel 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 Classes and Co-op Credits:
Create a variable
classes
and assign it the value10
.Create a variable
class_credits
and assign it the value3
.Create a variable
coop_credits
and assign it the value12
.Create a variable
graduation_requirement
and assign it the value180
.
Calculate the Total Credits:
Use multiplication to calculate the total credits from classes. Save it to the variable
total_class_credits
.Use addition to include the co-op credits. Save the total credits to the variable
total_credits
.
Calculate Remaining Credits:
Subtract the total credits from the graduation requirement.
Print the Results:
Use f-strings to display the Drexel ID, total credits, and remaining credits. We have provided this code for you so you do not have to write it.
# Drexel student's ID
drexel_id = ...
# Variables
# Number of classes taken
...
# credits per class
...
# Number of coop credits
...
# Graduation requirement
...
# Calculate total credits
...
# Calculate remaining credits
...
# DO NOT MODIFY BELOW THIS LINE
# Print the results
print(f"Student ID: {drexel_id}")
print(f"Total Credits Completed: {total_credits}")
print(f"Remaining Credits to Graduate: {remaining_credits}")
grader.check("practice-quiz-1-Grade")
๐ Well Done!#
Congratulations on completing the Drexel Credits Calculation! You are one step closer to graduation! ๐
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-practicequiz", "1_practice-quiz")