Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+5 votes

Questions in routine practice 12 or program practice 3 that include while loops and multiple functions: I have the output right in Thonny but when I put it in Moodle, it restarts the loop over even though it returns what is needed already and so it marks it wrong.

asked in old_CSC201 by (1 point)

1 Answer

+1 vote

When a problem asks you to write a function, then just include the definition of that function in the Moodle answer box, not the code the you used to test the function.

If you have included code, perhaps in a main function, that calls the function to test it, then my test code calls your function and your code calls the function a second time making the while loop in the function execute again since the function has been called twice.

answered by (1 point)
...