Exercise: Greeting, Depending on Time of Day¶
A greeting has to be composed automatically, based upon time of day and sex.
input()function to prompt the user on
stdinfor three variables,
Sex. Valid inputs are
f(female); all other input leads to program termination.
Hour of day. Valid inputs are number
23; all other input leads to program termination.
Depending on the hour of day, the greeting starts with
9: “Good morning, “
17: “Good day, “
23: “Good evening, “
Depending on the sex, the greeting continues with “Mrs.” or “Mr.”.
Last comes the name.
Finally, the greeting is output on