Page 432 - AI Ver 3.0 class 10_Flipbook
P. 432
• None: This is a special data type with NULL or nothing/no value. It does not mean 0, False or empty. It is
represented by None.
• Boolean: It is a data type with two built-in values: True or False. It is used in logical evaluation. A True value
represents 1 while a False represents 0.
[1]: 10<20
True
[2]: 20<10
False
• Sequence: It is a collection of data stored under a common name. Each value is referred by its index number. It
can be mutable or non-mutable. There are three types of data as sequence in Python:
✶ String: It is an ordered sequence of UNICODE characters enclosed in single or double quotes. Single-line
strings can be created using either single quotes or double quotes. The quotes are not part of string. They
only tell the computer where the string constant begins and ends. Its length is dependent on the available
memory. It can also be empty where we have just empty quotes with no value.
[1]: # Single-line
" "
• A multiline string in Python is a string that spans across multiple lines. It allows you to create a string that
contains line breaks and multiple paragraphs without using special characters like \n for newline. Multiline
strings are defined by enclosing the text within triple quotes, either single (''') or double (""") quotes.
[1]: # Multi-line String
'''It is
an interesting
Language'''
✶ Lists: It is a sequence of heterogeneous values arranged as elements and are referred by an index number.
These values are separated by comma and are enclosed in square brackets [ ]. They are mutable data types
as the values of these data types can be changed by the user after creation.
[1]: list_of_names=["Amit","Shweta","Peter","Zoya"]
Marks=[89,92,93,78,89]
Class10=[101,"Neha",89.5,102,"Shushil",92]
✶ Tuples: It is a sequence of heterogeneous values arranged as elements and are referred by an index number.
These values are separated by comma and are enclosed in circular brackets ( ). They are immutable as the
values of these data types cannot be changed by the user after creation.
[1]: mytuple=("Amit","Shweta","Peter","Zoya")
Marks=(89,92,93,78,89)
Class10=(101,"Neha",89.5,102,"Shushil",92)
• Set: A set is a collection of unique elements that is both mutable and unordered. Sets are defined using curly
brackets {} with elements separated by commas. Each element in a set must be unique. Sets are commonly used
for tasks that involve mathematical operations like union, intersection, and difference.
[1]: mySet = {21, 52, 33, 54, 95}
430 Touchpad Artificial Intelligence (Ver. 3.0)-X

