0
Syntax Error in Python
Hi! I've made this code: https://code.sololearn.com/c33RCD2f5H5X/#py I cannot make out the error.
8 Réponses
+ 1
You don't need to put global in python since when a variable is declared outside any python block it considers it global, global is a keyword that you can use inside functions when you want to modify the state of a global variable. problem solved.
https://www.google.com/url?sa=t&source=web&rct=j&url=https://www.geeksforgeeks.org/global-local-variables-python/amp/&ved=2ahUKEwjE-83sksnqAhVGMt8KHWZYAtsQFjADegQIAhAC&usg=AOvVaw3AzH98CtMNfFCuOU-Cvnur&cf=1
0
So I should remove global from where?
0
From everywhere where you don't need.
I advise you to first see the use of global and then return to the code.
0
I have removed the unrequired globals but a error is still coming.
0
It is not necessary to use multiple print to be able to a long paragraph instead you can use docstrings a like this in the code, something else is not necessary to use str (input ()) since input () returns a String and always give it format your code to look better.
0
And as a last suggestion visit the link that I put you in previous messages so you will understand why the global keyword is within some functions, since you might think that it is the same as you had it but it is not.
Happy Coding👌
0
Thank you I made some minor changes and it is working well.