What's the difference between a local and a global variable?

A global variable can be accessed from anywhere within the program whereas a local one can only be accessed from within the method it's declared in.

JH

Related Python Mentoring answers

All answers ▸

Whats the output of "for i in "hello world": print(i)" and why/how is this achieved


What is Object-Oriented Programming?


Print "Hello World!" ten times without typing (or pasting) the print function more than once


Write a program that can convert between celcius and farenheit temperature scales