+ 1
I keep seeing this one code being used but I don't remember ever being told about this...
I don't know what res means. def ex(x): res =+i Or something like that I don't understand it...
3 Antworten
+ 3
GD cheerios YT res is often used as short for result.
It's most used when you need to store the result of a calculation.
Eg:: res = math.cos(15) +5;
It's not compulsory to make sure the variable is called "res".
If used outside a function, it becomes a global variable.
If used within a function, it becomes a local variable
+ 1
Well I think I may understand it now but can someone check this:
def ex(y):
res = 0
Would res be referenced as a variable I just don't understand why its not as the top like this:
res = 0
def ex(y):
It probably is ok if its not at the top I am just used to putting variables at the top.
0
Ok thank you