Food for thought question?

The third question was implying that your the 27th person in a group of X amount of people so what groups would the 26th and the 28th person be in?

I’m a bit confused on the food for thought bit though everyone has figured some variation of it though is there a simpler way to solve it with the code we’ve learnt through this course?

So now I am a bit confused since I took you literally to see what you were saying and coded: #1 mod 4 1 print(1 % 4) with result = 1. What is the meaning of this result?

4 divided into 1 is 0 with remainder 1. The remainder is the modulo.

The “What are the numbers for all 4 teams?” isn’t a specific enough question to answer. Is it asking what numbers in the count-off will be on each team? Is it asking which team is assigned which number? If we knew what it was asking, we still may not be able to answer because the total number of the group of people has not been specified. Unless I am completely misunderstanding this food for thought exercise, it was an ambiguous, impossible task, which seems very sloppy.

After thinking about it maybe the question is asking which modulo numbers designate teams, meaning the answer would be: 0, 1, 2, and 3 instead of the more intuitive 1, 2, 3, and 4. Maybe they’re trying to get students to think in terms of starting with 0 instead of 1?

I agree that the question could have better put (especially for non English-speaking learners for whom the phrase “count off” is not idiomatic), but do not agree that we were therefore left with an “impossible task.” It’s not as if we needed to come up with a particular solution to proceed, as any response (or none) triggers a green check mark, and a look at this thread and several others shows that the task most certainly did supply “food for thought,” and provided a sandbox for many learners to investigate and experiment with the modulo operator. Not a bad thing!

Team0 = "Team 0: "
Team1 = "Team 1: "
Team2 = "Team 2: "
Team3 = "Team 3: "
My_team = 27 % 4
Person1 = 26 % 4
Person2 = 28 % 4
Count = 0
while Count < 28:
	Count += 1
	Answer = Count % 4
	if Answer == 0:
		Team0 += str(Count) + (",")
		pass
	elif Answer == 1:
		Team1 += str(Count) + (",")
		pass
	elif Answer == 2:
		Team2 += str(Count) + (",")
		pass
	elif Answer == 3:
		Team3 += str(Count) + (",")
		pass
print(Team1)
print(Team2)
print(Team3)
print(Team0)
print(My_team)
print(Person1)
print(Person2)
  

My attempt (Sorry i am new at coding)

What is the question? Does your attempt work? Do you have any comments on it?

If you’d like us to follow your code, please post it including Python’s mandatory indentations by making use of the </> icon that is in the menu bar that appears atop the text box when you open it for typing. That way, there’s no guesswork or mental translation involved, and we can copy and paste for testing!

So I was very confused by the wording of this exercise, but eventually i typed this and it just worked. Please understand I am VERY NEW to coding and I would love any help on an explanation on why compared to other people’s answers, mine was still accepted.

my_team = 27 % 4

print(my_team)

teams = 26 % 4; 28 % 4

print(teams)

Because that is all that was asked for. If one is number 27 of many, then they are on team # 3 of four teams. The person one number lower is on team # 2, and the person one number higher is on team # 0.

I think I started looking at this question and started overthinking it. I began wondering how to list out each number that would have been assigned to each team. Then I looked at what the tools I have been given and none of them seemed efficient at doing that.
So I looked at the question again.
It asks what are the numbers are for the 4 teams. It’s not asking for the number the person is. It’s asking what the 4 numbers that result from the modulo are

So my code is:
my_team = (27%4)
print(my_team)
my_team = (26%4)
print(my_team)
my_team = (28%4)
print(my_team)
my_team = (29%4)
print(my_team)

and it worked.

The “food for thought” question is exactly that–it simply asks you to think about it, figure it out on your own. It is not asking you to actually code anything for this question, so simply hitting “Run” again on the code from the previous answer is fine. Its not broken, it’s working as intended.

2 Likes

Hi @mishmercer2842930051, and welcome to the Codecademy Forums!

Yes, the “food for thought” question is a fine one. It is an invitation to be creative. You can simply think about it, or you can go so far as to write a function that provides an answer.

Link to exercise: Modulo

The “food” for thought" question:

  1. Food for thought: what number team are the two people next to you (26 and 28) on? What are the numbers for all 4 teams?

If we assume that your position and the total number of people are both variable, a function that reveals the numbers of the teams of your neighbor(s) would need two parameters. Be aware that you might be the only person there, in which case you would have no neighbors. If there are at least a few people there, you might be the first or the last to count off. In those cases, you would have only one neighbor. Otherwise, you would have two neighbors. Whatever the case, the function could return a list of the teams of your neighbors.

Here is a suggested function header:

def teams_next_to_you(your_number, number_of_people):

As a challenge, would anyone care to write such a function?

1 Like