Python 11 Modulo


Ok, so I’m not getting most of this lesson. Here is my code, but past the first part of finding what team you’re on, I can’t seem to understand the rest of it. Help please

my_team = 27 % 4
left_person = 26 % 4
right_person = 28 % 4


The assumption made in this code, is that member 1 is in team 1, member 2 in team 2, member 3 in team 3, member in team 4, person 5 in team 1 and so on:

for i in range(1, 28):
  print("person: %d" % i, end=", ")
  team = i % 4
  if team == 0:
    print("team: 4")
    print("team: %d" % team)

the only problem is that numbers divisible by 4 given zero, so you would nee to tweak the code a little bit


Thank you for your reply, I’m super new and the code you posted makes little to no sense to me. When the question asked how do you find the numbers for all teams, I’m assuming its asking to use modulo to do so, I don’t understand how that works.


Have you run the code? See how i put everyone in a team? In the output of my code, see if you can find the pattern of how i put everyone inside a team. Once you get this “pattern”, we can talk about the modulo operator usage here