Variables

VARIABLES - Python programming Language

Hey there, this is Subham from Technical Virus. Mainly today onwards our tutorial starts.  In this tutorial, we will learn about Variables. In this tutorial we will learn :


  1. What are Variables?
  1. Different Types of Variables
  1. How to create Variables?



Mainly we will discuss above three topics today.
python variables

So, what are the Variables?

  • As the name implies, a variable is something which can change. A variable is a way of referring to a memory location used by a computer program.

  So, you can understand now what Variable is. There is another way to represent a Variable. That is,
  • A Variable can be seen as a container (or some say a pigeonhole) to store certain values. While the program is running, variables are accessed and sometimes changed, i.e. a new value will be assigned to the variable.
   So, now you know that a Variable is like a container that stores a value or a data.

   Here another thing is there, the main data types of Variables. That is: 

  1. Numbers
  1. String
  1. List
  1. Tuple and
  1. Dictionary  

  This will be more  clear when you go through an example below,

Think that the two letters we have taken, that is "X" and "Y". Now we will assign a data or value to the letters. Like,   "X=5"  and "Y=9", so now we have assigned a data to the letters "X" and "Y". Now the letters become Variables. Now I think you will be able to understand.

Let's make a program of variables:

First, open the Pycharm app that you have previously installed, and type the code then execute and you will see the result.

--------------------------------------------------------------------------------------------------------------
var = 101
word="Hey I am a String"
print(var)
print(word)
--------------------------------------------------------------------------------------------------------------
Output:
--------------------------------------------------------------------------------------------------------------
101
Hey I am a String
--------------------------------------------------------------------------------------------------------------

You can check yourself to make sure. Here you can see through it is a High-Level Language its statements are really very easy.
You can see for printing a value simply the command here is "print".
There is no need of terminator in this programming language.

So, that's it for today. See you in the next tutorial.


Previous
Next Post »