Hey Programmers, In this Tutorial We will be Learning About Python Variables so We will be Learn What are Variables, How to Assign Values to a Variable And More.
Also Read: Python Data Types | Python Tutorial #5
Variables In Python are Used to Store Data In a memory. Or In Simple Words Variables are the Containers to Store Holds the Assigned Value Given By the User. Examples:
num = 20
In the Above Mentioned Example We Have Created a Variable named num which holds a value of 20, it means When we will print the value of num variable we will get the output 20.
num = 20
Changing the Value of a Variable
As we Saw In the Above Examples that we have assigned a value of 20 to a variable called num, And If your Mind Changes you want to change the from 20 to Let’s Say 100, So we can do this By Changing the Value Of the Variable.
num = 100
Now, it will print the value of num as 100, Because We Have Changed the Assigned Value of the Variable.
Assigning Values to Variables
In the Above Programs, We change the Values of the Variables, Now we will Assign Values to a Variable, Examples
mr programmer = "mrprogrammer.in"
# I Have Added the Link Of My Website in a Variable
Assigning Multiple Values to Variable
Now, we will See how to Assign Multiple Values In a Single Variable, let’s Say we have three variables fruits
apple banana cherry