Computer Science

Python Data Types Class 11 CBSE Computer Science: Numbers, Boolean, String, List, Tuple, Dictionary and None

Class 11 · Computer Science

Knowledge of Data Types in Python (CBSE Class 11 Computer Science)

Every value stored in a Python program has a specific data type. A data type tells Python what kind of value is being stored and what operations can be performed on it. Choosing the correct data type makes programs efficient, accurate, and easier to understand.


Learning Objectives

  • Understand Python Data Types.
  • Learn Numeric Data Types.
  • Understand Boolean Data Type.
  • Learn Sequence Data Types.
  • Understand Dictionary.
  • Learn None Data Type.
  • Differentiate between Mutable and Immutable Data Types.

What is a Data Type?

A Data Type specifies the type of value stored in a variable and determines the operations that can be performed on that value.

Definition: A data type is a classification that tells Python what kind of value is stored in a variable.

Classification of Python Data Types


Python Data Types

│

├── Number

│      ├── Integer

│      ├── Float

│      └── Complex

│

├── Boolean

│

├── Sequence

│      ├── String

│      ├── List

│      └── Tuple

│

├── Mapping

│      └── Dictionary

│

└── None

1. Number Data Type

The Number data type is used to store numeric values. Python supports three numeric types.

Integer (int)

Stores whole numbers without a decimal point.


age = 17

marks = 95

temperature = -5
ValueData Type
25Integer
-100Integer
0Integer

Floating Point (float)

Stores numbers containing decimal points.


height = 5.8

price = 249.50
ValueData Type
45.5Float
-12.75Float

Complex Number (complex)

Stores numbers having a real part and an imaginary part.


z = 4 + 5j

print(z)

Output


(4+5j)

Here, j represents the imaginary part.


2. Boolean Data Type

The Boolean data type stores only two values.

  • True
  • False

passed = True

eligible = False

Boolean values are mainly used in decision-making statements such as if and while.


3. String Data Type

A String is a sequence of characters enclosed in single quotes, double quotes, or triple quotes.


name = "Aman"

city = 'Jaipur'

message = """Welcome to Python"""

Output


Aman

Jaipur

Welcome to Python

4. List Data Type

A List is an ordered collection of elements enclosed in square brackets [].


marks = [85, 90, 92, 88]

print(marks)

Output


[85, 90, 92, 88]

Lists are mutable, which means their elements can be changed after creation.


5. Tuple Data Type

A Tuple is an ordered collection enclosed in parentheses ().


months = ("Jan", "Feb", "Mar")

print(months)

Output


('Jan', 'Feb', 'Mar')

Tuples are immutable, meaning their values cannot be modified after creation.


6. Dictionary Data Type

A Dictionary stores data as key-value pairs enclosed in curly braces {}.


student = {

    "Name": "Riya",

    "Age": 17,

    "Marks": 92

}

print(student)

Output


{'Name': 'Riya', 'Age': 17, 'Marks': 92}

7. None Data Type

The None data type represents the absence of any value.


result = None

print(result)

Output


None

Mutable and Immutable Data Types

Mutable Data Types

A mutable object can be modified after it is created.

  • List
  • Dictionary

Immutable Data Types

An immutable object cannot be modified after it is created.

  • Integer
  • Float
  • Complex
  • Boolean
  • String
  • Tuple
  • None

Comparison of Python Data Types

Data Type Example Mutable
Integer25No
Float25.5No
Complex4+5jNo
BooleanTrueNo
String"Python"No
List[1,2,3]Yes
Tuple(1,2,3)No
Dictionary{"A":10}Yes
NoneNoneNo

Checking the Data Type

Python provides the type() function to determine the data type of a value or variable.


x = 25

print(type(x))

y = "Python"

print(type(y))

Output


<class 'int'>

<class 'str'>

Think Like a Programmer

Predict the data type of each variable.


a = 100

b = 45.6

c = "CBSE"

d = True

e = [10,20]

f = (5,6)

g = {"Name":"Aman"}

h = None
Variable Data Type
aInteger
bFloat
cString
dBoolean
eList
fTuple
gDictionary
hNoneType

Real-Life Example

Imagine a student admission form.

  • Name → String
  • Age → Integer
  • Percentage → Float
  • Sports Quota → Boolean
  • Subjects → List
  • Date of Birth (fixed values) → Tuple (conceptually fixed)
  • Student Details → Dictionary

Common Beginner Mistakes

  • Using square brackets instead of parentheses for tuples.
  • Thinking strings are mutable.
  • Confusing lists with dictionaries.
  • Writing true instead of True.
  • Using none instead of None.
  • Forgetting that dictionary keys should be unique.

Memory Trick

  • [ ] → List → Mutable
  • ( ) → Tuple → Immutable
  • { } → Dictionary → Key-Value Pairs
  • " " → String
  • True / False → Boolean
  • None → No Value

Exam Tips

  • Remember which data types are mutable and immutable.
  • Practice identifying data types using type().
  • Know the difference between List, Tuple, and Dictionary.
  • Remember that True, False, and None start with capital letters.
  • Learn the symbols used for each collection data type.

Practice Yourself

  1. Write one example of each Python data type.
  2. Differentiate between List and Tuple.
  3. Differentiate between Mutable and Immutable data types.
  4. Write a Python program to display the data type of five variables using type().
  5. Create a dictionary to store your personal details.

Frequently Asked Questions (FAQs)

1. What is a data type?

A data type specifies the type of value stored in a variable.

2. Which Python data types are mutable?

List and Dictionary are mutable.

3. Which function is used to check the data type of a variable?

The type() function.

4. Can a string be modified after creation?

No. Strings are immutable.

5. What does None represent?

It represents the absence of a value.


Summary

  • Python supports Number, Boolean, String, List, Tuple, Dictionary, and None data types.
  • Lists and Dictionaries are mutable, whereas Strings, Tuples, Numbers, Boolean, and None are immutable.
  • The type() function is used to determine the data type of a variable.
  • Choosing the correct data type improves program efficiency and readability.
  • Understanding data types is essential before learning operators, expressions, and control statements.