Q:

How can I fix my weekdays, to output specific info on Saturdays and Sundays. From Mon to Fri, the people are at work and Sat to Sun is the weekend

This is part of a simulation. My current day acts as the current epoch and it always starts from 0. My current code is as follows:
    is_weekend = current_day % 5 == 0 or current_day % 6 == 0

    if is_weekend:
        print("people are at home")
    else:
        print("people are at work")

    for person in people:
        if is_weekend:
            person.location = "Home"
        else:
            person.location = "Work"

However, when I reach the second week of work in my programme, on Saturday they are at home but Sunday they are back at work. I thought using % would work but there seems to be a problem.

A:

The problem is that we have 7 days and you check for multiples of 5 and 6. With that logic, the 10th day would be the same weekday as the 5th day but that is wrong - a week later is the 12th day. Also, 0 % x returns 0 so you have to take this into consideration when working with the modulo operator. In our case, it does not matter because we don't check for 0 anymore.
weekdays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
for i in range(0, 14):
    day_of_week = i % 7;
    is_weekend = day_of_week == 5 or day_of_week == 6;
    print('The', i, 'day is a', weekdays[day_of_week], '=> is weekend?', is_weekend)

You have to check for a remainder of 5 and 6 for the current week because the week has 7 days.
The 0 day is a Mon => is weekend? False
The 1 day is a Tue => is weekend? False
The 2 day is a Wed => is weekend? False
The 3 day is a Thu => is weekend? False
The 4 day is a Fri => is weekend? False
The 5 day is a Sat => is weekend? True
The 6 day is a Sun => is weekend? True
The 7 day is a Mon => is weekend? False
The 8 day is a Tue => is weekend? False
The 9 day is a Wed => is weekend? False
The 10 day is a Thu => is weekend? False
The 11 day is a Fri => is weekend? False
The 12 day is a Sat => is weekend? True
The 13 day is a Sun => is weekend? True

This is how modulo works (in this case):
0 % 7 => 0 / 7 => remainder is 0
1 % 7 => 1 / 7 => remainder is 1
2 % 7 => 2 / 7 => remainder is 2
...
7 % 7 => 7 / 7 => remainder is 0
8 % 7 => 8 / 7 => remainder is 1
9 % 7 => 9 / 7 => remainder is 2

The modulo operator (in this case) will tell us how much is left when we divide the first number through 7 again and again ... until we reach a number that is smaller than the right number (i.e. 7) and this will be the result from the modulo operator.
300 / 7 = 42.8571 ... 42.8571 / 7 = 6.1224

but
300 % 7 = 6 <=> (int) (300 / 7) = 6

How close can we get without getting floating point numbers?
It is 294 because 42 * 7 = 294, 6 is missing to 300 and 6 is smaller than 7, therefore, remainder 6

