Page 445 - ComputerScience_Class_11
P. 445
• Finite Length: Every sequence has a defined length, which can be found using the len() function.
• Support Concatenation: Two sequences of the same type can be joined using the + operator.
• Support Repetition: Elements of a sequence can be repeated using the * operator.
• Can Be Mutable or Immutable: Some sequence types like list are mutable, while others like tuple and string
are immutable.
• Maintain Data Order: The arrangement of elements remains consistent unless explicitly changed (in mutable
types).
12.5 NONE
None is a special constant in Python that represents the absence of a value. It is used when a variable has no data
stored in it. None belongs to its own data type called NoneType. It is different from 0, False or an empty string.
Program 12: A None value is assigned to a variable.
Program 12.py
File Edit Format Run Options Window Help
# Assigning None value to variable
value = None
# Printing the value stored in the variable
print(value)
# Printing the data type of the variable
print(type(value))
Output
None
<class 'NoneType'>
12.5.1 Characteristics of None data types in Python
There are some characteristics of None data types in Python:
• Represents Absence of Value: None is used to indicate that a variable has no value or no data.
• Single Constant Object: There is only one None object in Python.
• Belongs to NoneType: The data type of None is NoneType.
• Immutable: The value None cannot be changed once assigned.
• Common Default Return Value: Functions that do not return any value automatically return None.
• Used as Placeholder: Often used to initialize variables when the actual value is not yet known.
• Case-Sensitive Keyword: None must always begin with a capital "N".
12.6 DICTIONARY
Dictionary is a data type in Python that stores data in the form of key–value pairs. Each key is unique and is used to
access its corresponding value. The most common mapping data type in Python is the dictionary. A dictionary uses
curly brackets { }.
Data Types in Python 443

