In python it doesn't matter. It used to matter in older versions of PHP.
I have to admit it is not a good idea to rely on global variables as far as possible. Try to pass arguments rather than directly accessing the global variables.
Consider the following example (Bad example).
num1 = 5
def add(num2):
return num1 + num2
the add function is not reliable and unpredictable because it returns different value depending upon the state of the global variable.
Now imagine some other part of your program executes the following code
del num1
In other words the num1 variable no longer exists but the add function still relies on the num1 global variable and the add function gets broken.
Now consider the following example (Better example).
def add(num1, num2):
return num1 + num2
There is still no type safety but it is a lot more better than the previous one and the function is more predictable and self contained.
You have to use a profiler to measure the execution speed of your scripts. Consider using a proper IDE like PyCharm.