# 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("8_arguments_and_return_q", "week_5", "readings", assignment_points = 20.0, assignment_tag = 'week5-readings')
# Initialize Otter
import otter
grader = otter.Notebook("8_arguments_and_return_q.ipynb")
โ Norman Doors - How, โNotโ to Design Arguments, Parameters, and Return Statements#
A Norman door is a term for a poorly designed door that confuses users about whether to push or pull, often due to unclear visual or tactile cues. Coined by Don Norman in The Design of Everyday Things, it highlights the failure of the design to communicate its function intuitively, often requiring labels like โPUSHโ or โPULLโ to compensate. Good design avoids such confusion by aligning the doorโs appearance and affordances (e.g., handles or flat plates) with its intended operation, ensuring usability without explanation.
# Run this block of code by pressing Shift + Enter to display the question
from questions._8_arguments_and_return_q import Question1
Question1().show()
# Run this block of code by pressing Shift + Enter to display the question
from questions._8_arguments_and_return_q import Question2
Question2().show()
# Run this block of code by pressing Shift + Enter to display the question
from questions._8_arguments_and_return_q import Question3
Question3().show()
Question 1 (Points: 6.0): Create a Function to Evaluate Door Usability#
Write a Python function named evaluate_door
that:
Accepts two arguments:
handle_type
(a string) anddoor_action
(a string).Returns
"Confusing"
if:The handle type is โpullโ but the action is โpushโ.
The handle type is โpushโ but the action is โpullโ.
Returns
"Clear"
if the handle type matches the action.
...
print(evaluate_door("pull", "push")) # Should print Confusing
print(evaluate_door("push", "push")) # Should print Clear
grader.check("Door-Assessment")
Question 2 (Points: 5.0): Create a Function to Recommend Door Fixes#
Write a Python function named recommend_fix
that:
Accepts two arguments:
handle_type
(a string) anddoor_action
(a string).Returns a string recommendation:
"Change the handle"
if the handle type does not match the action."No changes needed"
if the handle type matches the action.
...
# Example usage
print(recommend_fix("pull", "push")) # Should print Change the handle
print(recommend_fix("push", "push")) # Should print No changes needed
grader.check("Door-Recommendations")
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("week5-readings", "8_arguments_and_return_q")