0% found this document useful (0 votes)
5 views6 pages

Different Features of Python and Data Types After Lect - 1 and 2

Uploaded by

asimkp187
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views6 pages

Different Features of Python and Data Types After Lect - 1 and 2

Uploaded by

asimkp187
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

PYTHON

BASICS
DIFFERENT IMPLEMENTATIONS
OF PYTHON
DATA TYPES:
• Primitive Data Structures – These data structures contain simplified data
values and serve as the foundation for manipulating data. The four
primitive data structures are integers, float, string, and boolean.
• Non-primitive Data Structures – These data structures store values, as
well as a collection of values, in varying formats. The four built-in non-
primitive data structures are lists, tuples, dictionaries, and sets.
PRIMITIVE:
1. Integers in Python
In Python, integers are zero, positive, or negative whole numerals. They do not have a fractional part and have
unlimited precision.
Integers can have octal, binary, or hexadecimal values.

2. Float in Python
In Python, float represents the floating point number. They’re used to represent real numbers and are written
with a decimal point that divides the integer and fractional parts.
PRIMITIVE:
3. String in Python
In Python, a string is a collection of alphabets, characters, or words. While it’s one of the most
primitive of data structures, it’s also vital to data manipulation. Python has a built-in string class
known as str, which is immutable.

4. Boolean in Python
This is one of Python’s built-in data types, and it represents the truth value of an expression. The
Python boolean type has only two possible values: true or false. In other words, you can evaluate
any expression and get either true or false in response.
NON PRIMITIVE:
1. Lists in Python
o A list is an ordered collection of items and is one of the most essential data structures to implement in any
Python project. As these are “ordered collections,” each item in the list has an order which uniquely identifies
it.
o You can assign addresses to each element of the list (which are indexes). The index value begins at zero and
continues on until the last element (the positive index). There is also the negative index, which starts at -1.
This enables you to access elements from the very end to the very beginning.
o When creating a list, you should enclose all the items on the list within square brackets, and separate them by
commas.
o List_C = [item 1, item 2, item 3….., item n]
o Lists created in Python are mutable—meaning you can modify them after you’ve created them. This allows a
user to search, add, shift, delete, and move elements from a list.

You might also like