Modulo Operator (remainder example and logic)

PHOTO EMBED

Mon Mar 15 2021 13:53:47 GMT+0000 (Coordinated Universal Time)

Saved by @fre_apples #python

#You’re trying to divide a group into four teams. All of you count off, and you get number 27.

#Find out your team by computing 27 modulo 4. Save the value to my_team.
#example:
print(29 % 5)
# it returns 4, why that? Because if you divide 29/5 you obtain 5 with the remaining of 4 
# example 
my_team=(27%4)
print(my_team)
#output is 3

# to find out the team in each groups 
person = 0

while(person < 28):
  person = person + 1
  print("Person ", str(person), "= Team ", str(person % 4))
content_copyCOPY