Lesson : Python Basics Summary
Mandatory
Introduction to python
Python is a programming language that is easy to understand and write, making it a popular
choice among developers and programmers.
It is compatible with various programming paradigms, such as procedural, object-oriented, and
functional programming.
Python has a large and active community of developers, an extensive standard library, and
third-party packages for various domains.
Predefined keywords
Keywords are reserved words in Python that have special meanings and cannot be used as
identifiers (variable names, function names, etc.).
Examples of keywords
include if, else, while, for, def, class, import, try, except, return, True, False, None, etc.
Keywords are case-sensitive and cannot be redefined or overridden within a Python program.
Mutability & Immutability.
In Python, objects can be either changeable (modifiable) or unchangeable (unchangeable).
Mutable objects, such as lists and dictionaries, can be modified after creation, while immutable
objects, such as tuples and strings, cannot.
Mutability affects how objects are stored and manipulated in memory, impacting performance,
memory usage, and concurrency in Python programs.
Operators
Operators are special symbols or keywords that are used to carry out specific actions on
numbers or variables in Python expressions.
Python supports various types of operators, including arithmetic operators (+, -, *, /),
comparison operators (==, !=, <, >), logical operators (and, or, not), assignment operators
(=, +=, -=, *=, /=), etc.
Operators have precedence and associativity rules that determine the order of evaluation in
expressions.
Type Casting
Type casting, also referred to as type conversion, is the process of changing one data type to
another in Python.
Python provides built-in functions for type casting, such as int(), float(), str(), list(), tuple(), dict(),
etc.
Type casting is often necessary for performing arithmetic operations, data manipulation, and
input/output operations in Python programs.
Conditionals
Conditionals in Python are used to execute code based on the evaluation of one or more
conditions.
Python supports conditional statements such as if, elif (else if), and else to control the flow of
execution.
Conditionals can be nested to handle multiple conditions and control different branches of
execution based on the outcome of logical expressions.
Loops
In Python, loops are employed to repeat a sequence of actions or code until a specific condition
is fulfilled.
Python offers two primary types of loops: for loops and while loops.
“for” loops are used for iterating over a sequence of elements, while “while” loops are used for
executing code until a specified condition becomes False