# 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("17_operators_q", "week_1", "readings", assignment_points = 18.0, assignment_tag = 'week1-readings')
# Initialize Otter
import otter
grader = otter.Notebook("17_operators_q.ipynb")
โPython Operators#
# Run this block of code by pressing Shift + Enter to display the question
from questions._17_operators_q import Question1
Question1().show()
# Run this block of code by pressing Shift + Enter to display the question
from questions._17_operators_q import Question2
Question2().show()
# Run this block of code by pressing Shift + Enter to display the question
from questions._17_operators_q import Question3
Question3().show()
Instructions#
โMario the Dragon and the Handschumacher Dining Center Feastโ
Mario, the dragon mascot of Drexel, loves the Handschumacher Dining Center. Every week, he calculates his meal consumption to plan his legendary feasts. Mario knows he eats 21 meals per week (3 meals per day for 7 days). However, Mario is curious about how his meal plan aligns with his love of sharing.
Write a function named mario_meal_plan()
that:
Calculates the total number of meals Mario eats in a week.
Determines if the total meals can be split evenly among his 6 dragon friends (including himself).
Returns a string with the results. If the meals are evenly distributed, the string should say:
"Mario's meals divide evenly among 6 dragons, with each dragon eating X meals."
Otherwise, the string should say:
"Mario's meals do not divide evenly among 6 dragons, leaving Y extra meals."
Example Outputs:#
"Mario's meals divide evenly among 6 dragons, with each dragon eating 3 meals."
"Mario's meals do not divide evenly among 6 dragons, leaving 1 extra meal."
# Calculate total meals Mario eats in a week, save as a variable `total_meals`
total_meals = ...
# Number of dragons including Mario, save as a variable `num_dragons`
num_dragons = ...
# Calculate meals per dragon and any remainder
# names `meals_per_dragon` and `leftover_meals` respectively
...
# Do Not Change the print statement
# Determine result message
if leftover_meals == 0:
print(f"Mario's meals divide evenly among 6 dragons, with each dragon eating {meals_per_dragon} meals.")
else:
print(f"Mario's meals do not divide evenly among 6 dragons, leaving {leftover_meals} extra meals.")
grader.check("question-operators-mario-dining")
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-readings", "17_operators_q")