Do you wake up at the same time every morning? No, right? If it is a normal working day where you're swamped with work and meetings starting early morning, you try to wake up as soon as possible. If it is a weekend or a vacation day, you mostly want to give yourself some extra rest, right? Now, you might set alarms for this manually periodically depending on what day it is. Instead of manually setting up an alarm, what if you try to write a code that automates the time the alarm goes off. If there was some way for the alarm to know the kind of day it is, it would automatically ring according to the preferences set by you. Let's attempt to do this.
So the problem statement is, you're trying to automate your alarm clock by writing a function for it. You're given a day of the week encoded as 1 = Mon, 2 = Tue, ..., 6 = Sat, 7 = Sun, and whether you are on vacation as a boolean value (a boolean object is either True or False. Google "booleans Python" to get a better understanding).
Based on the day and whether you're on vacation, write a function that returns a time in form of a string indicating when the alarm clock should ring.
When not on a vacation, on weekdays, the alarm should ring at "7:00" and on the weekends (Saturday and Sunday) it should ring at "10:00".
While on a vacation, it should ring at "10:00" on weekdays. On vacation, it should not ring on weekends, i.e., it should return "off". You may have a look at the problem statement from the coding quiz question before proceeding with the video.
You must have a pretty good idea of how to draw simple flow diagrams now. Let's try and convert it to a code now.
The approach Sajan discussed was with a nested loop. You can do it using if... elif... elif... elif... else statement as well.
So you have now automated your alarm clock to ring according to your needs so that you can always catch that extra hour of sleep depending on the day. Feeling lazy already? Well, right now you have to keep your minds open and brains charged as there are many such questions to go in the upcoming segments.