08/05/2021
These types have been discussed in the sections that follow.
Sets: This is an un-ordered collection of elements.
Keywords: These are words having special meanings and are understood by the
interpreter. For example, and, del, from, not, while, as, elif, global,
else, if, pass, Yield, break, except, import, class, raise,
continue, finally, return, def, for, and try are some of the keywords
which have been extensively used in the book. For a complete list of keywords,
the reader may refer to the Appendix.
Operators: These are special symbols which help the user to carry out
operations like addition, subtraction, etc. Python provides following type of
operators:
Arithmetic operators: +, –, *, /, %, ** and //.
Assignment operators: =, + =, – =, *=, /=, %=, **= and //=
Logical operators: or, and, and not
Relational operators: =, != or < > and ==.
This chapter deals with the basic data types in Python and their uses. The chapter
has been organized as follows: Section 2 of this chapter deals with the
introduction to programming in Python and basic data types, and Section 3 deals
with strings. Section 4 deals with lists and tuples. The last section of this chapter
concludes the chapter. The readers are advised to go through the references at the
end of this book for comprehensive coverage of the topic.
BASIC DATA TYPES REVISITED
The importance of data types has already been discussed. There is another
reason to understand and to be able to deal with built-in data types, which is that
they generally are an intrinsic part of the bigger types which can be developed
by the user.
The data types provided by Python are not only powerful but also can be nested
within others. In the following discussion the concept of nested lists has been
presented, which is basically a list within a list. The power of data types can be
gauged by the fact that Python provides the user with dictionaries, which makes