All Courses
Python Variables

Python Variables

May 17th, 2019 python

Python Variables

1. Variables are named location to store a data in a memory location

Name = “Dhoni”
Note:  “Dhoni” is the data stored in the memory location called “Name”
2. Python is type inferred, so by default it identifies the type of the data stored.
Example :

Name = “Kohli”

Name = “Dhoni”

print(Name)

Ouput will be “Dhoni” because python creates a new object while we storing a new data into the existing variable.
3. We can assign more than one variable in a single line statement with corresponding data

Name,age,team = “Dhoni”,37,”CSK”

Each variables is separated by commas so to the values as well.
4. If we want to create a constant values, do follow the below coding standard

Import constant

TEAM = “CSK”

Print(constant.TEAM)

Rules to be followed:

  • Give capital letters for all the constant variable declaration
  • Use meaningful name for the variable declaration.
  • Never use special characters or numbers
Social Share:

0 responses on "Python Variables"

Leave a Message

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