You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Understand what the interviewer is asking for by using test cases and questions about the problem.
Will the input always be an integer?
Yes.
Should the function print anything out?
Yes.
P-lan
Plan the solution with appropriate visualizations and pseudocode.
General Idea: Print out a result based on how many hours the user slept.
1) Create a new function with a parameter representing the hours slept
2) Check if the number of hours meets each category. If it does, print that result.
I-mplement
defsleep_assessment(hours):
ifhours<8:
print("Oof, go back to bed!")
elifhours>=8andhours<=10:
print("You got a good night's rest!")
else:
print("You're a sleep prodigy!")