02-Python Basic

Data types, dynamic and strong type

2.1 Data Types

Data Type represent the type of data present inside a variable. In Python, we are not required to specify the type explicitly.

Based on value provided, the type will be assigned automatically. Hence, Python is Dynamically Typed Language.

Python contains the following inbuilt data types

Char Type:        str
Numeric Types:    int, float, complex
Sequence Types:   list, tuple, range
Mapping Type:     dict
Set Types:        set,  frozenset
Boolean Type:     bool
Binary Types:     bytes, bytearray, memoryview
None Type:        NoneType
[Read More]

03-Python Basic

Flow Control(loop, if-else)

3 Flow Control

Flow control describes the order in which statements will be executed at runtime.

Python has 3 types of control-flow

  • Conditional Statements or Decision Making statements
if
if-else
if-elif-else
  • Iterative Statements
for
while
  • Transfer Statements
break
continue
pass
[Read More]

05-Python Basic

String data-types

5. String Data Type

Strings are used to record the text information such as name. In Python, Strings act as Sequence which means Python tracks every element in the String as a sequence. This is one of the important features of the Python language.

For example, Python understands the string “hello' to be a sequence of letters in a specific order which means the indexing technique to grab particular letters (like first letter or the last letter).

Note: In most of other languges like C, C++,Java, a single character with in single quotes is treated as char data type value. But in Python we are not having char data type. Hence it is treated as String only.

[Read More]

06-Python Basic

Python list data types

6 List Data Structure

List is used when we want to represent a group of values as a single entity where insertion order required to preserve and duplicates are allowed then we should go for list data type

  • List is one of the most frequently used and very versatile data types used in Python.
  • List items are ordered, mutable, heterogeneous and allow duplicate values.
  • List items are indexed, the first item has index [0], the second item has index [1] etc.
[Read More]

07-Python Basic

Python Tuple and Set data types

7.1 Tuple Data Structure

Tuple is exactly same as List except that it is immutable. i.e once we creates Tuple object,we cannot perform any changes in that object. Hence Tuple is Read Only version of List.

  • Tuple are immutable and insertion order is preserved
  • Duplicates and Heterogeneous objects are allowed
[Read More]

08-Python Basic

Dictionary and dictionary operations

8. Dictionary Data Structure

Dictionaries are used to store data values in key-value pairs

  • Duplicate keys are not allowed but values can be duplicated.
  • Hetrogeneous objects are allowed for both key and values.
  • Insertion order is not preserved
  • Dictionaries are mutable
  • Indexing and slicing concepts are not applicable

As of Python version 3.7, dictionaries are ordered. In Python 3.6 and earlier, dictionaries are unordered.

[Read More]

09-Python Basic

Functions, Parameters, Arguments, Generator, Iterator

9. Functions

If a group of statements is repeatedly required then it is not recommended to write these statements everytime separately.

We have to define these statements as a single unit, and we can call that unit any number of times based on our requirement without rewriting. This unit is nothing but function.

  • The main advantage of functions is code Reusability.
  • Python supports 2 types of functions
    1. Built-in Functions
    2. User Defined Functions
[Read More]