×
FREE ASSISTANCE FOR THE INQUISITIVE PEOPLE
Tutorial Topics
X
softetechnologies
Introduction Python Examples - If else Programs CBSE
Data Types and Variables - Python Language
2306    Arnab De    05/09/2020

Data Types

In any computer programming language, data type defines how a data store in memory. How much memory size occupied by a data is also determined by data types. Like other languages Python has also the following built-in data types.

softetechnologies
Text Type str
Numeric Types int, float, complex
Sequence Types list, tuple, range
Mapping Type dict
Set Types

set, frozenset

Boolean Type bool
Binary Types bytes, bytearray, memoryview
softetechnologies

Variables

A variable is named memory location. That means a variable basically allocates a memory location, which is mapped with a name called variable name. In python, we can declare a variable without any data type. But its data type was set just after we assign a value to it.

 

Rules of a variable names

  • A variable name must start with a letter or the underscore character.
  • A variable name cannot start with a number.
  • A variable name can only contain alpha-numeric characters and underscores
  • Variable names are case-sensitive (Name, name and NAME are three different variables)
softetechnologies

Assign multiple variables with multiple values in one line

We can assign multiple values in different variables in a line.

x,y,z=10,20,30

This line is equivalent to

x=10

y=20

z=30

Assign multiple variables with the same value

x=y=z=10

This line is equivalent to

x=10

y=10

z=10

Introduction Python Examples - If else Programs CBSE
softetechnologies
Author Details
Arnab De
I have over 16 years of experience working as an IT professional, ranging from teaching at my own institute to being a computer faculty at different leading institute across Kolkata. I also work as a web developer and designer, having worked for renowned companies and brand. Through tutorialathome, I wish to share my years of knowledge with the readers.
Enter New Comment
Comment History
No Comment Found Yet.
Leo Tolstoy
However diffcult life may seem, there is always something you can do, and succeed at. It matters that you don not just give up.
Leo Tolstoy
8576
90.33
Today So Far
Total View (Lakh)
softetechnologies
26/05/2018     55447
25/06/2018     46538
01/01/2018     44508
28/06/2017     42235
02/08/2017     41370
01/08/2017     35209
06/07/2017     34980
15/05/2017     34107
11/09/2018     32213
14/07/2017     31236
softetechnologies