For loops and if statements in a class

How do I get a class to create these four teams and just change the modulo nr and team number, instead of typing the code four times?

team1 =
team2 =
team3 =
team4 =
team_num = range(1,28)

for i in team_num:
if i%4 == 0:
team1.append(i)
print(team1)

for i in team_num:
if i%4 == 1:
team2.append(i)
print(team2)

for i in team_num:
if i%4 == 2:
team3.append(i)
print(team3)

for i in team_num:
if i%4 == 3:
team4.append(i)
print(team4)

Did you mean a class or a function? You might find it a bit easier if you changed the team names to, or included them within, a sequence like a list. After that consider what value i % 4 takes on every iteration of the loop, print it out if necessary. Perhaps that could be used for some kind of indexing?