+ 2

"time is not defined"?

i'm trying to make a time distance calculator in which each object would represent a problem, or "implementation" of the formula, distance = speed * time(that might not be 100% correct, don't quote me. anyway, the problem is that the compiler keeps throwing an error any time i try to run, saying that "time is not defined". I've made time a global variable within a try catch loop, so a little more clarity on what I've done wrong here. the error is within the classmethod speedTime at line 28: https://code.sololearn.com/ci1J3MWTCfUn side note: is there anything wrong with declaring global variables in the way i did? edit: the problem was with the control variable, being that you cannot use "loop" more than once.

13th Nov 2017, 7:45 PM
X-1
X-1 - avatar
1 Resposta
+ 5
I don't recall who posted this last (perhaps you are just seeing this for the first time), but the last time I answered this question I asked how the control variable at line 43 was being used. This was intended to get the viewer to ask themselves how this was working -- basically, explain it. The fact that I am ignoring the global variable is intended to also be a hint. Since this question is new again, I'll let the hint be one for a little while in case it helps (you / anyone).
12th Nov 2017, 8:33 PM
Kirk Schafer
Kirk Schafer - avatar