There are two types of variables in python local and global variables.
• In Python, global variable is a variable declared outside of the function or in global scope.
• global variable can be accessed inside or outside of the scope function
Local variables are the variables that are used with in a function or method.
Global variables are used when we use the variable in the entire program.
• Python allows us to assign values to the variables.
• Lets assume the value 5 is assigned to the variable ‘a’
• In multiple assignment , multiple variables are assigned with multiple values.
Example
• Lets first see how to declare a variable. Its that simple that assigning variable a value to hold.
Example
>>> a=9
>>> print(a)
9
Now we re declare the variable.
a=9
print(a)
a= 33
print(a)
output:
33
Here the output gives the re assigned value instead of first value. This means that the first value is replaced by second value.
• In python you can delete the variable that you previously assigned the value using del command.
Example
a=7
print(a)
del a
print(a)
Introduction: When your Hisense TV won't connect to WiFi, it is rarely a problem with…
Hisense Google TV Storage Space Running Out: Why it Happens and How to Fix It…
Introduction: "Setting up a soundbar with your Samsung TV should be simple, but the HDMI…
User Problem Scenario: The Red Light "Panic" You press the power button on your Samsung…
Introduction: I Know the Feeling "We’ve all been there. You sit down to watch your…
User Problem Scenario: The "Diagnosis Loop" Paradox Imagine you notice your apps are slow. You…