What are variables
Hello friends today I will tell you about what are variables because the most important part of any program or programming language is variables so before learning that you have to understand with an example and after that I will tell you about What are variables in practical way so read the article carefully.
What are variables |
What are variables
So friends first we have to understand through an example so try to understand.
Variable is the most important thing in any program or programming language because a computer program totally depend upon variables to do any work, computer program do nothing but run your all variables then you will get the result so I think now you understand importance of variables in any computer program.
So the example is that:-
Guys you can see many types of container in your home in which you can store many things like in your kitchen there will be oil container to which you use to store oil and you can also see sugar container in which you can store sugar in it.
What are variables |
Just like that variable is also a container in any program which help you to store your information like you can store list in variables.
You have to understand it by practical so let’s do practical of using variables in python:-
You have to write print”Hello world” in python and you have to run the code, now as a result you will get Hello world
Now the use of python is if you want to type a article of 2000 words in the place of Hello world and also want to use that article in more than 10 places now what should you do
You have to put your 2000 words article in a container and when you need it you have to write name of the container python will recognize that you want to use that 2000 words article in this place through this your work will become very easy to you, now don’t confuse the container is variable and you have to store your 2000 words article in one variable then if you need this article in any place during building program you can use it by just writing the name of this variable.
What are variables |
You have to understand the process with the help of practical so let’s follow me.
You have to use (var) where you want to store your data like
(var1) = “Hello world”
You have to write your 2000 words article in the place of “Hello world” so that your article will get store in (var1) and when you want to use this article you can use it by just writing (var1) in place of your 2000 word article like if you want to print your article you have to use
(var1) = “Hello world”
Print (var1)
Now you have to run the article and i will get “Hello world” as a result and you will get your 2000 words article or whatever you write as a result.
Now you can use you data in any place during building program with the use of (var1). Variable make your work easy you can save your much time during building any program by using variables to store many data which you want again and again in you program.