Core Fundamentals
What is Python?
Python is a programming language known for its simplicity and versatility. It’s an interpreted, object-oriented, high-level language with dynamic semantics. What makes Python strong is its built-in, high-level data structures. This makes it a powerful choice for various applications.
- 7 Modules
- 48 Lessons
- Fahim Ul Haq
1. Variables
Variables
Explore how Python variables work by understanding their declaration rules, case sensitivity, and types such as local and global variables. Learn to use variables effectively to store and manage data within your Python programs.
Declaration and Reassignment
Explore how to declare variables in Python without explicitly defining types, understand how to reassign values, and learn to create multiple variables in one line. This lesson clarifies Python’s approach to variable naming and assignment for beginners.
Input and Output Variables
Explore how to use input variables to capture user data and output variables to display results in Python. Learn to combine these techniques to create interactive programs that handle user input and provide dynamic output messages.
Local and Global Variables
Explore how to define and use local and global variables in Python. Understand their different scopes, lifetimes, and how variable precedence works within and outside functions to manage data properly.
Operations on Variables
Explore how to perform various operations on Python variables including arithmetic operations like addition and string concatenations. Understand how to store results in variables and prepare for more advanced operator concepts in programming.
"Type" of Python Variable
Explore how to determine and modify the type of Python variables using the type() method. Understand the concept of data types and learn to reassign variable types effectively as you develop your Python programming skills.
Type Casting Variables
Explore how to perform type casting in Python by converting variables between types like integers and strings. Understand when conversions are valid and how to avoid errors with incompatible types.
Constants
Explore how to define and use constants in Python, understanding the convention of naming constants in uppercase to prevent accidental changes. This lesson helps you recognize constant values in your code and apply good programming practices for reliable calculations.
Hands on Exercies
Explore hands-on Python exercises focused on variables, including creating and manipulating them and converting data types. This lesson helps you reinforce your understanding of Python variables by applying concepts in practical coding tasks.
2. Data Types
Python Data Types
Explore the fundamental Python data types, including both primitive and compound categories. Understand how data types define the kind of data a variable holds and learn through examples to clarify these concepts for practical programming.
Primitive Data Types
Explore the fundamental Python primitive data types such as integers, floats, strings, booleans, and NoneType. Understand their characteristics and how to use them effectively in coding through detailed explanations and examples.
Compound Data Types
Explore the core Python compound data types such as lists, tuples, dictionaries, and sets. Learn their characteristics, how they handle different data types, and discover practical examples to build your foundational programming skills.
Lists, Tuples, Dictionaries and Sets
Explore the key Python data types including lists tuples dictionaries and sets. Understand their properties such as mutability and uniqueness. Learn how to create update and use each type through examples to effectively manage data in Python
Hands on Exercise
Practice identifying and correcting syntax errors in Python comments and docstrings. This lesson helps you apply knowledge to enhance code readability and maintainability by working through practical coding exercises.
3. Comments
Python Comments
Explore how to use Python comments effectively to clarify code, assist maintenance, document changes, and guide development. Understand inline and multiline comment styles to write clear, readable Python code.
Single-Line Comments
Discover how to use single-line comments in Python to enhance your code’s clarity. This lesson guides you through adding comments with the hash symbol and demonstrates how multiple comments help describe complex code functions, improving readability and maintainability.
Inline Comments
Discover how to use inline comments effectively in Python to enhance code readability and documentation. Learn when and how to add comments on the same line as code, improving your ability to communicate code logic clearly without overusing comments.
Commenting Code
Explore how to use comments in Python to enhance your code’s clarity and maintainability. Understand how to comment out sections to test or block code, helping you to write more manageable programs.
Multiline Comments
Explore how to add multiline comments in Python by using docstrings and manually placing the # symbol before lines of code. Understand the purpose and use of docstrings for documenting functions and improving the clarity of your code.
Hands on Exercise
Practice identifying and correcting syntax errors in Python comments and docstrings. This lesson helps you apply knowledge to enhance code readability and maintainability by working through practical coding exercises.
4. Booleans
Python Booleans
Explore the concept of Python booleans, including how to create and use True and False values in variables. Understand how booleans can represent different states or conditions within data structures, and practice evaluating boolean expressions to control program flow.
The Bool() Method
Explore how to use Python’s bool() method to convert various data types into boolean values. Understand the conditions that lead to True or False evaluations and learn how custom classes can override this behavior for specific needs.
Evaluating Expressions
Explore how to evaluate expressions in Python using boolean values and operators like and, or, and not. Understand comparison operators to create conditions that control program flow. This lesson helps you grasp core principles of boolean logic and apply them to practical coding problems.
Sub-Type of Int
Explore how Python defines the Boolean type as a subtype of integer, where True and False correspond to integer values 1 and 0 respectively. Understand the distinction between value equality and object identity through practical examples, enabling you to better grasp Python’s data model and logic evaluation.
Hands on Exercise
Explore practical exercises on Python Booleans to test your understanding of boolean evaluation and logical conditions. Learn how to apply boolean operators and the bool() method to solve real coding problems and strengthen your Python skills.
5. Operators
Python Operators
Learn about Python operators and their practical applications. Explore arithmetic, assignment, comparison, logical, identity, membership, and bitwise operators. Understand operator precedence and associativity to write clear and efficient Python code.
Arithmetic Operators
Explore Python’s arithmetic operators such as addition, subtraction, multiplication, division, floor division, power, and modulo. Understand how to apply these operators with example code and practice using them with different numbers to gain hands-on experience in Python programming.
Assignment Operators
Explore Python assignment operators and understand how to update variable values using expressions such as addition, subtraction, multiplication, division, and others. Learn practical ways to apply these operators to simplify your code and perform calculations efficiently within Python.
Comparison Operators
Explore Python’s comparison operators to understand how they evaluate relationships between variables. Learn to write and test expressions using equal, not equal, greater than, less than, and related operators. This lesson helps you grasp core concepts essential for decision-making in Python programming.
Logical Operators
Explore how to apply logical operators in Python to test multiple conditions using and, or, and not. Learn to combine expressions to create complex conditionals and understand their practical use in code evaluation.
Identity Operators
Explore how Python identity operators is and is not work to compare whether two variables refer to the same object in memory. Understand examples with lists and different data types, and learn how to apply these operators in your Python code effectively.
Membership Operators
Explore how to apply Python membership operators to determine if elements exist within sequences like lists, strings, and sets. Understand the behavior of in and not in operators, including case sensitivity in strings, to write effective and accurate membership tests.
Bitwise Operators
Explore how Python’s bitwise operators work on binary numbers to perform operations like AND, OR, XOR, and NOT, as well as left and right bit shifting. Understand how these operators allow you to manipulate bits directly and apply efficient arithmetic operations like multiplication or division by two.
Operator Precedence and Associativity
Explore how Python evaluates expressions by understanding operator precedence and associativity. This lesson helps you grasp the order in which operators execute and how parentheses affect evaluation, enabling you to write clearer and more accurate Python code.
Hands on Exercise
Explore Python operators through practical exercises that reinforce your understanding of operator types, precedence, and bitwise operations. Test and deepen your coding skills by predicting outputs and analyzing code behavior.
6. Input / Output
Python Input
Explore how to use Python’s built-in input() function to capture user input, include prompts for clarity, convert input types appropriately, and validate inputs to handle errors. This lesson helps you write programs that interact with users accurately and robustly, ensuring smooth data gathering and processing.
Python Output
Explore how Python’s print() method outputs various data types to the console. Understand using formatted strings and the format() method to present variables cleanly. Learn numeric output formatting and basic error handling with print statements to create reliable output in your programs.
Hands on Exercise
Explore Python input and output concepts by completing practical exercises that help you apply input(), print(), and data formatting methods effectively. This lesson guides you to take user input, convert data types, and format numerical output for clear program results.
7. Lists
Python Lists
Explore the fundamental concept of Python lists and understand how to organize, access, and manipulate data efficiently. This lesson covers list properties like mutability, order, and support for heterogeneous and nested elements, enabling you to use lists effectively in various programming tasks.
Creating Lists
Explore how to create and initialize lists in Python using different methods including literals list constructors and list comprehensions. Understand the syntax and practical uses to efficiently store and manipulate data within your programs.
Accessing Lists
Explore how to access individual elements and portions of Python lists using indexing and slicing techniques. Learn about positive and negative indexing and how to manage errors when accessing invalid indices.
Adding to Lists
Understand how to add elements to Python lists using the append method to add single items and the extend method to add multiple elements at once. This lesson helps you practice modifying lists in-place to efficiently manage and combine data structures in Python.
Modifying Lists
Explore how to modify single elements, update multiple items, and reassign entire lists in Python. Understand list indexing and slicing methods to efficiently handle and update list data for practical programming tasks.
Deleting from Lists
Explore various methods to delete elements from Python lists, including using del, remove(), clear(), and pop() methods. Learn to manipulate list data effectively by removing single or multiple elements, deleting by value, emptying lists, and extracting items with pop. This lesson enhances your ability to manage Python lists efficiently.
List Slicing
Explore how to use Python list slicing to access specific parts of a list, update elements, and manipulate data efficiently. Understand inclusive and exclusive indexing, the step parameter for skipping elements, and how to use negative indices for slicing and reversing lists.
List Comprehension
Explore how to create and manipulate Python lists efficiently using list comprehensions. Learn to apply expressions, conditions for filtering, and nested comprehensions to transform and manage data in lists effectively.
List Methods
Explore Python’s built-in list methods to learn how to add, remove, modify, and organize list elements. Understand practical usage of methods such as append, extend, insert, remove, pop, sort, and reverse to handle list operations efficiently in your code.
Hands on Exercise
Explore hands-on exercises to practice Python list manipulation. Learn to remove multiple elements using index ranges, modify list items with string formatting, and find list indices dynamically. This lesson helps you reinforce core list concepts in Python programming.
Key Concepts
Variables & Data Types
Control Flow
Functions
Data Structures
Strings
Input / Output
Python Syntax
Errors & Debugging