Shisuko's blog

By Shisuko, history, 5 weeks ago, In English

In particular, ideally I would like to know how to do it "properly" such that if I ask them to implement two functions, then these two functions should not be able to send information to each other (such as through globals, for example)

Is this even possible in Python?

Thank you!

  • Vote: I like it
  • +8
  • Vote: I do not like it

»
5 weeks ago, # |
  Vote: I like it +7 Vote: I do not like it

Yes, it can be done.

Write the grader in resources section then select it as grader for *.py files at runtime

»
5 weeks ago, # |
  Vote: I like it +8 Vote: I do not like it

I don't think there's a way to make sure that the two functions don't send information to each other, because there's no way to explicitly ban globals. One trick of doing this is designing the problem such that there's one right return for a function, and then making sure that the functions get called in independently executed runs. Another way to do this is to shuffle the order in which the functions get called such that sending information from one another is meaningless.