Skip to content
Home » Variables In Python | Python Tutorial #4

Variables In Python | Python Tutorial #4

Python Tutorial #4

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.

Python Variables

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
print(num)

Output:

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
print(num)

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 
print(mr programmer)

Output:

mrprogrammer.in

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

fruits= ['apple','banana',cherry]
print(fruits)

Output:

apple banana cherry

1 thought on “Variables In Python | Python Tutorial #4”

  1. Pingback: Python Data Types | Python Tutorial #5 - Mr Programmer

Leave a Reply

Your email address will not be published. Required fields are marked *

You cannot copy content of this page

Top 10 Programming Languages to Learn In 2023! 9 Best Extensions For Web Developers! | Chrome Extensions For Web Developers Web Development Roadmap Best Resources to Learn PYTHON FREE! Web Vs App Development- Which one is Better?