text: # Don't rush be quiet - absolutely stumped
  
  I’m completely stumped on this level. It seems like a massive jump up in complexity without a lot of good explanation about what this new mod() function is actually doing. I’m just staring blankly at the screen, then watching as my hero dies in slow motion. Any help much appreciated.
  
  ``````def mod30(n):
  if n >= 30:
  return n - 30
  else:
  return n
  
  # This function should return a value from 0 to 40 (0 <= n < 40)
  def mod40(n):
  # Use an if-statement to return the correct value.
  if n <= 40:
  return n
  
  # You don't need to change the following code:
  while True:
  time = hero.time
  x = mod30(time) + 25
  y = mod40(time) + 10
  hero.moveXY(x, y)
  ``````
  
  Hi Chris,
  
  In terms of solving the level, the code for the function for mod40 is nearly identical to the code for function mod30.
  
  You’ve just made me look back at the level, and I don’t think it’s particularly useful for teaching. Apart from anything else, the function doesn’t always calculate the modulus (it works for the numbers being used in the level, but it doesn’t work for bigger numbers).
  
  To get a better understanding of what it’s trying to do, here’s nearly the same code (I changed one word, and then called the function to find the modulus of 278):
  
  ``````def mod30(n):
  while n >= 30:
  n = n - 30
  else:
  return n
  
  answer = mod30(278)
  print(answer)
  ``````
  
  Copy the code into http://www.pythontutor.com and click ‘Visualise execution’ - you can then go through it step by step.
  
  Cheers,
  
  Jenny
  
  In other words
  
  and
  
  are the same functions
  
  Hi Jenny,
  
  Thanks for another great reply. I just got past the level by tracking down the correct answer from somewhere. I still dont really understand it, even though i understand the concept of modulus and remainders when ive heard it talked about in other places. Hopefully i can understand how the CoCo system uses it better by progressing through.
  
  Thanks again,
  Chris
  
  1 Like
  
  Thanks a lot for helping. After taking a week away and coming back to it, and applying everyones ideas i managed to solve the level!
  Chris
  
  1 Like
explanation: The document is a discussion thread from a coding forum where a user named Chris is seeking help with a coding challenge involving the `mod()` function. The thread includes a code snippet and responses from other users, including Jenny, who provides an explanation and a modified code example to help Chris understand the concept of modulus. The document contains multiple questions and answers related to the coding challenge.
distilabel_metadata.content: Evaluate the user given text extract and determine if it contains a math question and optionally and answer to this question.
  
  Output rules:
  
  1. Briefly describe the document and mention if it contains a question or a question and answer.
  2. Finalize the output with: Label: no-question,question,question-and-answer,multiple-question,multiple-question-and-answer
distilabel_metadata.role: system
distilabel_metadata.content: # Don't rush be quiet - absolutely stumped
  
  I’m completely stumped on this level. It seems like a massive jump up in complexity without a lot of good explanation about what this new mod() function is actually doing. I’m just staring blankly at the screen, then watching as my hero dies in slow motion. Any help much appreciated.
  
  ``````def mod30(n):
  if n >= 30:
  return n - 30
  else:
  return n
  
  # This function should return a value from 0 to 40 (0 <= n < 40)
  def mod40(n):
  # Use an if-statement to return the correct value.
  if n <= 40:
  return n
  
  # You don't need to change the following code:
  while True:
  time = hero.time
  x = mod30(time) + 25
  y = mod40(time) + 10
  hero.moveXY(x, y)
  ``````
  
  Hi Chris,
  
  In terms of solving the level, the code for the function for mod40 is nearly identical to the code for function mod30.
  
  You’ve just made me look back at the level, and I don’t think it’s particularly useful for teaching. Apart from anything else, the function doesn’t always calculate the modulus (it works for the numbers being used in the level, but it doesn’t work for bigger numbers).
  
  To get a better understanding of what it’s trying to do, here’s nearly the same code (I changed one word, and then called the function to find the modulus of 278):
  
  ``````def mod30(n):
  while n >= 30:
  n = n - 30
  else:
  return n
  
  answer = mod30(278)
  print(answer)
  ``````
  
  Copy the code into http://www.pythontutor.com and click ‘Visualise execution’ - you can then go through it step by step.
  
  Cheers,
  
  Jenny
  
  In other words
  
  and
  
  are the same functions
  
  Hi Jenny,
  
  Thanks for another great reply. I just got past the level by tracking down the correct answer from somewhere. I still dont really understand it, even though i understand the concept of modulus and remainders when ive heard it talked about in other places. Hopefully i can understand how the CoCo system uses it better by progressing through.
  
  Thanks again,
  Chris
  
  1 Like
  
  Thanks a lot for helping. After taking a week away and coming back to it, and applying everyones ideas i managed to solve the level!
  Chris
  
  1 Like
distilabel_metadata.role: user
distilabel_metadata.raw_output_q_a_detector_0: The document is a discussion thread from a coding forum where a user named Chris is seeking help with a coding challenge involving the `mod()` function. The thread includes a code snippet and responses from other users, including Jenny, who provides an explanation and a modified code example to help Chris understand the concept of modulus. The document contains multiple questions and answers related to the coding challenge.
  
  Label: multiple-question-and-answer