-
Notifications
You must be signed in to change notification settings - Fork 242
Today's Mood
Sar Champagne Bielert edited this page Apr 8, 2024
·
14 revisions
Unit 1 Session 1 (Click for link to problem statements)
Understand what the interviewer is asking for by using test cases and questions about the problem.
- Should the function always print the same mood?
- Yes.
- Should the mood variable be updated inside the function definition or passed as a parameter
- The mood variable is set inside the function definition
- Does the function require any parameters when being called?
- No, the function does not require any parameters as indicated by the lack of a variable name in the signature todays_mood()
Plan the solution with appropriate visualizations and pseudocode.
General Idea: Make a function that prints an emoji representing today's mood.
1) Create a new function by writing a function signature
2) Create a variable to store the current mood emoji
3) Print "Today's mood:" followed by the value of the variable
3) Call the created function
- Emojis are considered characters by python, and thus need to be put in quote-marks, like strings.
def todays_mood():
mood = "🥱"
print("Today's mood: " + mood)
todays_mood()