global keyword in python
问题 I'm studying python, and getting struggle with the global keyword within vscode . So far the code is working, but the vscode linter is raising an error, and I would like to understand why I've tried using the global keyword, and the code works fine even though I got a linter error. I try using a local variable and didn't get any error def whatIs (): global myvalue myvalue +=10 print("myvalue: {}".format(myvalue)) myvalue=10 whatIs() print("myvalue: {}".format(myvalue)) The linter points to