Global variables and when to use them? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Global variables and when to use them?

I wrote two functions which performed the same action (see the code). One didn't took any arguments and made use of Python scoping rule(LEGB) while the other one did take one and returned it. My question is which one would be a better practice and why? https://code.sololearn.com/c6tjBEpSfEax/?ref=app

23rd Feb 2020, 4:54 PM
Azmat
2 Answers
+ 1
Mirielle👽 HonFu thanks for the info, I will pay more attention to the search function.
23rd Feb 2020, 6:51 PM
Azmat
0
Mirielle👽 is there any reason or it is just a convention?
23rd Feb 2020, 5:05 PM
Azmat