Programming
21 articlesConditionals
4- Boolean Expressions★★
A Boolean expression is any expression that evaluates to either True or False. Understanding Boolean logic is essential for writing conditions and controlling program flow.
- Conditionals★
Conditionals allow a program to make decisions by running different blocks of code depending on whether a condition is true or false.
- If-Else Statements★
An if-else statement lets a program make decisions and follow different paths based on whether a condition is true or false. Decision-making is at the heart of every useful program.
- Logical Operators★★
Logical operators (and, or, not) combine Boolean expressions to create more powerful conditions. They are essential for writing programs that can handle complex real-world rules.
Data Types
4- Data Types★
Every value in a program has a data type that determines what kind of information it holds and what operations can be performed on it.
- Lists and Arrays★★
A list stores multiple values in a single variable in a specific order. Lists are one of the most powerful data structures in Python and appear in almost every real program.
- Strings★
Strings store and manipulate text in programs. Python has a rich set of string operations that make it easy to process names, messages, and any other text data.
- Type Conversion★★
Type conversion changes a value from one data type to another. Python provides built-in functions to convert between integers, floats, strings, and Booleans.
Functions
4- Built-in Functions★
Python comes with dozens of ready-made functions you can use immediately without writing any extra code. Knowing the most common ones saves time and makes your programs more readable.
- Functions★
Functions let you group a block of code under a name so you can reuse it anywhere in your program. They are the key to writing clean, organised, and maintainable code.
- Parameters and Arguments★★
Parameters let functions accept input values, making them reusable for different situations. Understanding the difference between parameters and arguments is key to writing flexible code.
- Return Values★★
A return value is the result a function sends back to the code that called it. Return values let functions produce data that can be stored, printed, or used in further calculations.
Overview
1Loops
4- For Loops★★
A for loop repeats a block of code a known number of times, or once for each item in a collection. It is the most common type of loop in Python.
- Loops★
Loops let a program repeat a block of code multiple times without writing it out over and over. They are one of the most powerful tools in programming.
- Nested Loops★★★
A nested loop is a loop placed inside another loop. They are used to work with grids, tables, and any situation that requires repeating a repetition.
- While Loops★★
A while loop repeats a block of code for as long as a condition remains true. It is perfect when you do not know in advance how many times you need to repeat.
Variables
4- Assignment and Expressions★
Assignment stores a value in a variable. Expressions calculate new values using operators. Together they are the engine behind almost every program.
- Constants★
A constant is a named value that never changes while a program is running. Using constants makes code easier to read, maintain, and debug.
- Variable Scope★★
Scope determines which parts of a program can see and use a variable. Understanding scope prevents confusing bugs and helps you write cleaner code.
- Variables★
A variable is a named container that stores data in a program. Understanding variables is the first step to writing meaningful code.