+ 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...

7th Dec 2018, 6:21 PM
GD cheerios YT
GD cheerios YT - avatar
3 Réponses
+ 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
7th Dec 2018, 6:38 PM
Dlite
Dlite - avatar
+ 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.
7th Dec 2018, 6:28 PM
GD cheerios YT
GD cheerios YT - avatar
0
Ok thank you
7th Dec 2018, 6:41 PM
GD cheerios YT
GD cheerios YT - avatar