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 ▸

Using the shared code editor, write a recursive function for calculating a factorial of an input parameter.


How do you write code to implement a recursive fibonacci algorithm?


What is the difference between & and && operators?


Create a program that takes in two numbers and returns the highest of the two