0

Why does the third part of this code don't work?

https://code.sololearn.com/cXOLg2IZuriC/?ref=app

21st Aug 2018, 8:49 AM
SlowFast
SlowFast - avatar
4 Respuestas
+ 2
If you want to modify a variable var inside the function you need either to use a local variable, or to use a global var statement. Since you modify var3 python assumes it is local, and not the global var3. And it cant print it.
21st Aug 2018, 9:04 AM
VcC
VcC - avatar
0
Error message says it all: local variable 'var3' referenced before assignment Switch lines 34 and 35.
21st Aug 2018, 8:51 AM
strawdog
strawdog - avatar
0
Yes, I know it, but why I can't reference it? (the other two codes are similar)
21st Aug 2018, 8:54 AM
SlowFast
SlowFast - avatar
0
Thanks!
21st Aug 2018, 9:06 AM
SlowFast
SlowFast - avatar