Introduction
I started learning Python to build a strong foundation in programming and understand how applications are developed using Python.
Python is a high-level, interpreted programming language known for its simple syntax and readability. It is widely used in web development, automation, data science, artificial intelligence, and many other areas.
During my learning sessions, I explored Python fundamentals, operators, control flow, data structures, functions, file handling, and Object-Oriented Programming.
1. Python Fundamentals
I learned about Python's features, history, and applications.
Some important concepts included:
- Python was created by Guido van Rossum and released in 1991.
- High-level and interpreted language.
- Simple and readable syntax.
- Platform independent.
- Supports Object-Oriented Programming.
- Provides a large standard library.
I also learned how to install Python, configure VS Code, and write my first Python programs using print().
2. Variables, Identifiers and Data Types
I explored how Python stores and manages information using variables.
Important topics:
- Identifiers: Names used for variables, functions, and classes.
- Keywords: Reserved words with special meanings.
- Variables: Containers used to store data.
- Statements: Instructions executed by Python.
- Expressions: Combinations of values and operators that produce results.
I also studied Python naming rules and basic data types such as strings, integers, floats, and booleans.
3. Python Operators
Operators are used to perform calculations, comparisons, and logical operations.
I studied different categories:
- Arithmetic: Addition, subtraction, multiplication, division, floor division, modulus, and exponentiation.
- Assignment: Assigning and updating variable values.
- Relational: Comparing values using operators such as ==, !=, >, and <.
- Logical: Using
and,or, andnot. - Identity: Using
isandis not. - Membership: Using
inandnot in. - Bitwise: Performing operations on binary values.
I also practiced small programs such as calculators, area calculations, and number comparisons.
4. Input, Output and Type Conversion
I learned how to receive information from users using input() and display results using print().
An important concept was that input() returns a string by default.
Type conversion helps convert values into different data types.
Examples:
age = int(input("Enter your age: "))
price = float(input("Enter price: "))
print("Age:", age)
print("Price:", price)
I also explored string operations and numeric data types.
5. Conditional Statements and Loops
I studied how Python makes decisions and repeats instructions.
Conditional Statements:
- if
- elif
- else
- Nested if
Loops:
- for loop
- while loop
- Nested loops
I also practiced loop control statements:
- break: Stops the loop.
- continue: Skips the current iteration.
- pass: Acts as a placeholder.
Practical exercises included number patterns, multiplication tables, factorials, Fibonacci series, and checking prime numbers.
6. Python Data Structures
I explored the main built-in data structures used to store collections of values.
- List: Ordered and mutable collection.
- Tuple: Ordered and immutable collection.
- Set: Collection of unique elements.
- Dictionary: Stores data in key-value pairs.
I practiced accessing, updating, adding, removing, and iterating through collection elements.
I also studied common operations and methods used with these data structures.
7. Functions in Python
Functions allow us to organize code into reusable blocks.
I studied:
- Built-in functions.
- User-defined functions using
def. - Lambda functions.
- Function parameters and return values.
- Local and global scope.
- Default, positional, and keyword arguments.
- Arbitrary arguments using
*argsand**kwargs. - Recursive functions.
I also practiced creating reusable functions for calculations, validations, and other operations.
8. List Comprehension and Functional Tools
I learned how to create and process collections using shorter and reusable expressions.
Important topics:
- List Comprehension: Creating lists using a compact syntax.
- Lambda: Creating small anonymous functions.
- map(): Applying a function to each element.
- filter(): Selecting elements based on a condition.
- reduce(): Combining elements into a single result.
These concepts helped me understand different ways to process collections in Python.
9. Modules and File Handling
I studied how Python modules help organize and reuse code.
Topics included:
- User-defined modules.
- Built-in modules.
- Importing modules.
- Math and statistics modules.
- Random and datetime modules.
I also learned file handling operations:
- Opening files using
open(). - Reading and writing files.
- Appending content.
- Working with file modes such as
r,w,a, andx. - Using
withto manage files safely.
10. Exception Handling
Exception handling helps manage runtime errors without unexpectedly stopping a program.
I studied:
- try
- except
- else
- finally
- raise
- Built-in exceptions.
- Multiple exception handling.
- User-defined exception classes.
I also explored shallow copy and deep copy to understand how objects and nested data are copied.
11. Regular Expressions
I learned about Regular Expressions (Regex) and how Python's re module can be used for pattern matching and text processing.
Some important methods:
match()search()findall()split()sub()
12. Object-Oriented Programming (OOP)
One of the important parts of my Python learning journey was understanding Object-Oriented Programming.
I studied how classes and objects help organize code and represent real-world entities.
Important concepts:
- Class: A blueprint for creating objects.
- Object: An instance of a class.
- self: A reference to the current object.
- Constructor: The
__init__()method, which runs when an object is created.
I also explored instance variables, class variables, and different types of methods:
- Instance methods.
- Class methods.
- Static methods.
Main OOP Principles
Inheritance: Allows one class to inherit properties and methods from another class.
Types covered:
- Single inheritance.
- Multiple inheritance.
- Multilevel inheritance.
- Hierarchical inheritance.
- Hybrid inheritance.
Polymorphism: Allows the same method or operator to behave differently depending on the object or data type.
Encapsulation: Protects internal data using access conventions and methods such as getters and setters.
Abstraction: Hides implementation details and exposes essential functionality using concepts such as abstract classes.
13. Generators, Iterators and Decorators
I also explored some advanced Python concepts.
- Generators: Produce values one at a time using
yield, helping reduce memory usage. - Iterators: Allow elements to be accessed one by one using
__iter__()and__next__(). - Decorators: Add functionality to existing functions without directly changing their code.
These topics helped me understand reusable logic and more advanced Python programming techniques.
Key Takeaways
Through these lessons, I gained a better understanding of:
- Python syntax, variables, and data types.
- Operators and conditional statements.
- Loops and control flow.
- Lists, tuples, sets, and dictionaries.
- Functions and reusable code.
- Modules and file handling.
- Exception handling and regular expressions.
- Object-Oriented Programming.
- Generators, iterators, and decorators.
Conclusion
Learning Python helped me build a strong foundation in programming and problem-solving.
The most valuable part of this journey was practicing concepts through small programs and exercises. Understanding functions, data structures, exception handling, and OOP gave me a better foundation for developing backend applications.
I look forward to applying these concepts in real-world projects using Python and Django.