CSP Unit 4 Lesson 10 AP Practice Question

I have a student asking why the answer is School day. I would appreciate help with an explanation that they will understand.

  1. day_of_week is first assigned a value of “Saturday”.
  2. Next statement replaced that value with “Monday”. The value “Saturday” is garbaged!
  3. So now, since the day_of_week is neither “Saturday” nor “Sunday”, the if condition is false.
  4. The else part is executed, function weekday is called which displays “School day”.
1 Like

Thank you so much! This is exactly my thinking but i guess my brain was on overload because I just couldn’t put it to words! I appreciate your help.

Terra