Python Tutorial - Creating Variables

What is Variables?
Variable is used to store data value unlike other programming language python has no command for declaring variable for example in c,c++,java you have to define type of variable it can be int,float,double,string etc.But in python we don't have to explicit define data type python does it implicitly.


Creating Variables?
For Creating Variable We only need to define variable name then assigning value for that variable and we can use that value by calling the name of variable.

Input                                                         



Output


As above example display there i have used two variable name,y and assigned variable to them then printed that variable's value.

Variable Names Should contain
 1) Variable name can start with letter or underscore
 2) Variable name can not start with digit
 3) Variable name can only contain letter,digit & underscore
 4) Variable name are case-sensitive 


We can assign values to Multiple variables
 Python has special feature which allows to assign values to   multiple variables

For example:
name1,name2,name3="xyz","abc","bca"
print(name1,name2,name3)

Input                


Output                                        


Comments

Popular posts from this blog

Python Tutorial Introduction

Python Indentation or Python Syntax

Python Comment