Now that you have chosen a programming language, it’s time to learn the fundamentals of coding. Every programming language has key concepts that you must understand before moving to advanced topics.
Learn the Basics of Programming.
1. Understanding Basic Concepts
🔹Variables and Data Types
➡A variable is a container for storing data.
➡Data types define the kind of values a variable can hold (numbers, text, etc.).
Example (Python):
name = "Manish" # String
age = 18 # Integer
height = 5.9 # Float
is_student = True # Boolean
print(name, age, height, is_student)
➡ Common Data Types:
| Data Type | Example | Usage | |-----------|----------|------------| | String (str) | "Hello" | Stores text | | Integer (int) | 10 | Whole numbers | | Float (float) | 3.14 | Decimal numbers | | Boolean (bool) | True / False | Yes/No values |
🔹 Operators
Operators perform operations on variables and values.
➡ Basic Math Operators:
a = 10
b = 5
print(a + b) # Addition → 15
print(a - b) # Subtraction → 5
print(a * b) # Multiplication → 50
print(a / b) # Division → 2.0
➡ Comparison Operators: (Used for decision-making)
print(10 > 5) # True
print(10 == 5) # False
print(10 != 5) # True
🔹Conditional Statements (if-else)
Conditional statements let the program make decisions based on conditions.
Example (Python):
age = 18
if age >= 18:
print("You are an adult!")
else:
print("You are a minor!")
➡ Output: You are an adult!
🔹 Loops (for, while)
Loops allow you to repeat tasks without writing the same code multiple times.
➡ For Loop (Repeats a task for a fixed number of times)
for i in range(1, 6):
print("Hello", i)
➡ Output:
Hello 1
Hello 2
Hello 3
Hello 4
Hello 5
➡ While Loop (Repeats a task until a condition is met)
count = 1
while count <= 5:
print("Counting:", count)
count += 1
🔹 Functions (Reusable Code Blocks)
Functions allow you to write code once and use it multiple times.
Example (Python):
def greet(name):
print("Hello, " + name + "!")
greet("Manish")
greet("Shetty")
➡ Output:
Hello, Manish!
Hello, Shetty!
🔹 2. Practice What You Learn (Mini Challenges)
➡ Basic Challenge: Print your name, age, and favorite number.
➡ Math Challenge: Write a program to add two numbers.
➡ Decision-Making Challenge: Write a program that checks if a number is even or odd.
➡ Loop Challenge: Print numbers from 1 to 10 using a loop.
🔹 3. Next Steps
Once you're comfortable with these basics, move to:
➡ Small beginner projects (like a calculator, to-do list app, etc.).
➡ Understanding Data Structures & Algorithms (DSA)