1๏ธโฃ Variables
Variables are used to store data in a program.
Example:
name = "John"
age = 25
Here, name and age are variables.
๐ Think of a variable as a labeled box that stores a value.
2๏ธโฃ Data Types
Data types define what kind of data you're working with.
Common types:
โข Integer โ 10
โข Float โ 10.5
โข String โ "Hello"
โข Boolean โ True / False
โข List/Array โ [10, 20, 30]
Understanding data types is essential because different types support different operations.
3๏ธโฃ Operators
Operators allow you to perform operations on data.
Examples:
โข โ Addition
โข โ Subtraction
** โ Multiplication
/ โ Division
== โ Equal to
โ Greater than
< โ Less than
&& โ Logical AND
4๏ธโฃ Input & Output
Programs need to receive information and provide results.
Input โ Data given to the program.
Output โ Result produced by the program.
Example:
name = input("Enter your name: ")
print(name)
5๏ธโฃ Conditional Statements
Conditions allow your program to make decisions.
Example:
if age >= 18:
print("Adult")
else:
print("Minor")
๐ Conditions are the foundation of decision-making in programming.
6๏ธโฃ Loops
Loops allow you to execute code repeatedly.
Common loops: for, while
Example:
for i in range(5):
print(i)
Instead of writing the same code five times, a loop handles it automatically.
7๏ธโฃ Functions
A function is a reusable block of code designed to perform a specific task.
Example:
def add(a, b):
return a + b
Now you can call: add(10, 20)
๐ Functions make code reusable, organized, and easier to maintain.
8๏ธโฃ Parameters & Arguments
Parameters are variables defined by a function.
Arguments are the actual values passed to the function.
Example:
def greet(name): โ name is a parameter
greet("John") โ "John" is an argument
9๏ธโฃ Lists / Arrays
Lists or arrays allow you to store multiple values together.
Example: numbers = [10, 20, 30, 40]
You can access individual elements using an index. numbers[0] โ 10
๐ Strings
Strings represent text. name = "Akshay"
You should learn how to: concatenate, find characters, slice, change case, search, format text.
1๏ธโฃ1๏ธโฃ Dictionaries / Hash Maps
Store data as key-value pairs.
student = {
"name": "John",
"age": 25
}
Access data quickly using its key.
1๏ธโฃ2๏ธโฃ Sets
A set stores unique values. {1, 2, 2, 3} โ {1, 2, 3}
Useful for removing duplicates, union, intersection.
1๏ธโฃ3๏ธโฃ Scope
Scope determines where a variable can be accessed.
A variable created inside a function may not be accessible outside.
1๏ธโฃ4๏ธโฃ Recursion
A function that calls itself. Needs a base case + recursive case.
Used a lot with trees, graphs, and algorithms.
1๏ธโฃ5๏ธโฃ Exception Handling
Handle errors gracefully.
Python example:
try:
result = 10 / 0
except ZeroDivisionError:
print("Cannot divide by zero")
1๏ธโฃ6๏ธโฃ Debugging
Finding and fixing problems. Learn to read error messages, use breakpoints, print variables, test small sections.
๐ Good programmers are good at finding and fixing mistakes.
1๏ธโฃ7๏ธโฃ Modules & Libraries
Don't build everything from scratch.