def function(a,b,c):
temp = a
for i in (b,c):
if i > temp:
temp = i
return temp
function(43,54,12)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-127543af6285> in <module>()
----> 1 function(43,54,12)
NameError: name 'function' is not defined
[1]: https://i.stack.imgur.com/atmRn.png
CodePudding user response:
Call to function
should be done after the function is declared and defined as the interpreter first interpret the function and then evaluate the function call.
Make sure you call function(43, 54, 12)
after the function
itself is defined.
Also make sure you change the indentation from 2 space to 4 spaces when pressing Tab by going in Tools > Setting > Editor
and changing:
CodePudding user response:
I used a new notebook within colab, and the same code worked just fine. This probably is a colab-related issue. 1: https://i.stack.imgur.com/zzamQ.png
I'm still curious as to why it happened tho