Data Science & Machine Learning
76.9K subscribers
850 photos
68 files
762 links
Join this channel to learn data science, artificial intelligence and machine learning with funny quizzes, interesting projects and amazing resources for free

For collaborations: @love_data
Download Telegram
๐—”๐—œ ๐—ถ๐—ป ๐—ฃ๐—ฟ๐—ผ๐—ฑ๐˜‚๐—ฐ๐˜ ๐— ๐—ฎ๐—ป๐—ฎ๐—ด๐—ฒ๐—บ๐—ฒ๐—ป๐˜ ๐—™๐—ฅ๐—˜๐—˜ ๐—ข๐—ป๐—น๐—ถ๐—ป๐—ฒ ๐— ๐—ฎ๐˜€๐˜๐—ฒ๐—ฟ๐—ฐ๐—น๐—ฎ๐˜€๐˜€ ๐Ÿ˜

๐Ÿ’ซ Join this live masterclass and gain practical insights into AI-powered Product Management, in-demand skills

๐Ÿ’ซRoadmap to building a successful Product Management career

Eligibility :- Recent Graduates & Working Professionals

๐—ฅ๐—ฒ๐—ด๐—ถ๐˜€๐˜๐—ฒ๐—ฟ ๐—™๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜๐Ÿ‘‡ :-

https://pdlink.in/44VeqIA

( Limited Slots ..Hurry Upโ€ )

Date & Time :- 11th July 2026 , 8:00 PM (IST)
โค4
๐Ÿš€ Data Science Roadmap 2026

๐Ÿ“˜ Phase 1: Programming Fundamentals

๐Ÿ Topic 2: Python Operators

In the previous lesson, you learned about Variables & Data Types. Now it's time to learn how Python performs calculations, comparisons, and logical operations using operators.

Operators are one of the most fundamental concepts in Python. You'll use them in almost every program, from simple calculations to complex Machine Learning algorithms.

๐Ÿ”น 1. What are Operators?

Operators are special symbols used to perform operations on variables and values.

Example:

a = 10
b = 5
print(a + b)


Output:

15  


Here, "+" is an operator that adds two numbers.

๐Ÿ”น 2. Types of Operators in Python

Python has several types of operators:

โœ… Arithmetic Operators

โœ… Comparison Operators

โœ… Assignment Operators

โœ… Logical Operators

โœ… Membership Operators

โœ… Identity Operators

๐Ÿ”น 3. Arithmetic Operators โญ

Used for mathematical calculations.

Operators:

โ€ข ** + Addition**: 10 + 5 = 15

โ€ข - Subtraction: 10 - 5 = 5

โ€ข ** Multiplication*: 10 * 5 = 50

โ€ข / Division: 10 / 5 = 2.0

โ€ข // Floor Division: 10 // 3 = 3

โ€ข % Modulus (Remainder): 10 % 3 = 1

โ€ข ** Exponent: 2 ** 3 = 8

Example:

a = 10
b = 3
print(a + b)
print(a - b)
print(a * b)
print(a / b)
print(a // b)
print(a % b)
print(a ** b)


๐Ÿ”น 4. Comparison Operators โญ

Used to compare two values. The result is always True or False.

Operators:

โ€ข == Equal to

โ€ข != Not Equal to

โ€ข > Greater than

โ€ข < Less than

โ€ข >= Greater than or Equal to

โ€ข <= Less than or Equal to

Example:

x = 20
y = 10
print(x > y)
print(x == y)
print(x != y)


Output:

True  
False
True


๐Ÿ”น 5. Assignment Operators

Used to assign values to variables.

x = 10
x += 5
print(x)


Output:

15


Other assignment operators:

x -= 2  
x *= 3
x /= 2


๐Ÿ”น 6. Logical Operators โญ

Used to combine multiple conditions.

and

Returns True only if both conditions are True.

age = 25
print(age > 18 and age < 30)


Output:

True


or

Returns True if at least one condition is True.

print(age < 18 or age < 30)


Output:

True


not

Reverses the result.

print(not(age > 18))


Output:

False


๐Ÿ”น 7. Membership Operators

Used to check whether a value exists in a sequence.

in

fruits = ["Apple", "Banana", "Mango"]
print("Apple" in fruits)


Output:

True


not in

print("Orange" not in fruits)


Output:

True


๐Ÿ”น 8. Identity Operators

Used to check whether two variables refer to the same object.

is

a = [1, 2]
b = a
print(a is b)


Output:

True


is not

x = [1, 2]
y = [1, 2]
print(x is not y)


Output:

True


๐Ÿ”น 9. Operator Precedence

Python follows the PEMDAS/BODMAS rule while evaluating expressions.

Example:
โค5๐Ÿ‘1
result = 10 + 5 * 2
print(result)


Output:

20  


Multiplication is performed before addition.

Use parentheses to change the order.

result = (10 + 5) * 2
print(result)


Output:

30


๐Ÿ”น 10. Real-World Example

salary = 60000
bonus = 5000
total_salary = salary + bonus
is_high_salary = total_salary > 50000
print(total_salary)
print(is_high_salary)


Output:

65000  
True


๐ŸŽฏ Key Takeaways

โœ… Operators perform calculations and comparisons.

โœ… Arithmetic operators are used for mathematical operations.

โœ… Comparison operators return True or False.

โœ… Logical operators help combine multiple conditions.

โœ… Membership operators check if a value exists in a sequence.

โœ… Identity operators check whether two variables refer to the same object. 

Double Tap โค๏ธ For More
โค8
๐— ๐—ถ๐—ฐ๐—ฟ๐—ผ๐˜€๐—ผ๐—ณ๐˜ ๐—™๐—ฅ๐—˜๐—˜ ๐—Ÿ๐—ฒ๐—ฎ๐—ฟ๐—ป๐—ถ๐—ป๐—ด ๐—ฅ๐—ฒ๐˜€๐—ผ๐˜‚๐—ฟ๐—ฐ๐—ฒ๐˜€๐ŸŽ“

Offers a wide range of free learning resources through Microsoft Learn, helping students, freshers, and professionals build job-ready skills at their own pace.

โœ… 100% FREE self-paced learning modules
โœ… Official learning platform from Microsoft

๐Ÿ”— ๐—˜๐—ป๐—ฟ๐—ผ๐—น๐—น ๐—™๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜๐Ÿ‘‡:

https://pdlink.in/4paqRJS

Explore Microsoftโ€™s free resources. Build in-demand skills and make your profile stronger.
โค3
Which operator is used for exponentiation (power) in Python?
Anonymous Quiz
27%
A) ^
64%
B) **
7%
C) //
3%
D) %
โค5
Which logical operator returns True only if both conditions are True?
Anonymous Quiz
13%
A) or
7%
B) not
78%
C) and
2%
D) in
๐Ÿ‘2โค1
๐— ๐—ฎ๐˜€๐˜๐—ฒ๐—ฟ ๐—ง๐—ต๐—ฒ๐˜€๐—ฒ ๐—›๐—ถ๐—ด๐—ต-๐——๐—ฒ๐—บ๐—ฎ๐—ป๐—ฑ ๐—ฆ๐—ธ๐—ถ๐—น๐—น๐˜€ ๐˜๐—ผ ๐—Ÿ๐—ฎ๐—ป๐—ฑ ๐—›๐—ถ๐—ด๐—ต-๐—ฃ๐—ฎ๐˜†๐—ถ๐—ป๐—ด ๐—๐—ผ๐—ฏ๐˜€ ๐Ÿ”ฅ

This guide highlights 3 powerful skills that are opening doors to high-paying roles across tech and business .๐ŸŽ“

Perfect For
๐Ÿ‘จโ€๐ŸŽ“ Students
๐Ÿ’ผ Freshers
๐Ÿ“ˆ Job seekers trying to improve employability
๐Ÿš€ Anyone who wants to build a future-proof career with better salary potential

๐Ÿ”— ๐—˜๐—ป๐—ฟ๐—ผ๐—น๐—น ๐—™๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜๐Ÿ‘‡:

https://pdlink.in/4vXeGmm

๐Ÿš€ Start learning today. Build in-demand skills. Position yourself for better opportunities and bigger career growth.
โค4
๐Ÿš€ Data Science Roadmap 2026

๐Ÿ“˜ Phase 1: Programming Fundamentals

๐Ÿ Topic 3: Python Input & Output

In the previous lesson, you learned about Python Operators. Now it's time to learn how Python interacts with users by taking input and displaying output.

Input and Output (I/O) are fundamental concepts because almost every real-world program accepts input, processes it, and produces meaningful output.

๐Ÿ”น 1. What is Input & Output?

A Python program generally follows three steps:

Input โ†’ Process โ†’ Output

Example:

โ€ข User enters two numbers Input

โ€ข Python adds them Process

โ€ข Sum is displayed Output

๐Ÿ”น 2. Displaying Output

Python uses the print() function to display information on the screen.

Example

print("Hello, Data Science!")


Output

Hello, Data Science!


๐Ÿ”น 3. Printing Variables

You can print variables along with text.

name = "Deepak"
print(name)


Output:

Deepak


Or:

name = "Deepak"
print("Welcome", name)


Output:

Welcome Deepak


๐Ÿ”น 4. Taking User Input

Python uses the input() function to receive input from users.

name = input("Enter your name: ")
print("Hello", name)


Example Output:

Enter your name: Deepak
Hello Deepak


๐Ÿ”น 5. Important Note โญ

The input() function always returns a string, even if the user enters a number.

age = input("Enter age: ")
print(type(age))


Output:

<class 'str'>


๐Ÿ”น 6. Converting Input to Integer

To perform mathematical operations, convert the input using int().

age = int(input("Enter your age: "))
print(age + 5)


Example:

Enter your age: 25
30


๐Ÿ”น 7. Taking Decimal Input

Use float() for decimal numbers.

price = float(input("Enter price: "))
print(price)


๐Ÿ”น 8. Taking Multiple Inputs

You can take multiple inputs in a single line.

name, city = input("Enter your name and city: ").split()
print(name)
print(city)


Example Input:

Deepak Mumbai


Output:

Deepak
Mumbai


๐Ÿ”น 9. Formatting Output

Using f-Strings โญ Recommended

name = "Deepak"
age = 25
print(f"My name is {name} and I am {age} years old.")


Output:

My name is Deepak and I am 25 years old.


Using .format()

name = "Deepak"
print("Welcome {}".format(name))


๐Ÿ”น 10. Example Program

name = input("Enter your name: ")
age = int(input("Enter your age: "))

print(f"Hello {name}")
print(f"Next year you will be {age + 1} years old.")


Example Output:

Enter your name: Deepak
Enter your age: 25
Hello Deepak
Next year you will be 26 years old.


๐Ÿ”น 11. Common Mistake

num1 = input("Enter first number: ")
num2 = input("Enter second number: ")
print(num1 + num2)


Input:

10
20


Output:

1020


Why?

Because both values are strings.

Correct way:
โค5
num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number: "))
print(num1 + num2)


Output:

30


๐Ÿ”น 12. Real-World Example

salary = float(input("Enter your monthly salary: "))
annual_salary = salary * 12
print(f"Your annual salary is {annual_salary}")


๐ŸŽฏ Practice Questions 

1. Take your name as input and print a welcome message. 

2. Take two integers as input and print their sum. 

3. Take a student's marks as input and print them using an f-string. 

4. Take the radius of a circle as input and calculate the area. 

5. Take your birth year as input and calculate your approximate age. 

๐ŸŽฏ Key Takeaways

โœ… Use print() to display output

โœ… Use input() to accept user input

โœ… input() always returns a string

โœ… Convert input using int() or float() when needed

โœ… Use f-strings for clean and readable output formatting 

Double Tap โค๏ธ For More
โค10๐Ÿ”ฅ1
๐ŸŽ“ ๐—ง๐—ผ๐—ฝ ๐—–๐—ผ๐—บ๐—ฝ๐—ฎ๐—ป๐—ถ๐—ฒ๐˜€ ๐—ข๐—ณ๐—ณ๐—ฒ๐—ฟ๐—ถ๐—ป๐—ด ๐—™๐—ฅ๐—˜๐—˜ ๐—–๐—ฒ๐—ฟ๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ๐˜€ ๐—ถ๐—ป ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ

Boost your resume with Industry-recognized certifications without spending a single rupee ๐ŸŒŸ

๐Ÿ“š Available from:
โœ… Google
โœ… Microsoft
โœ… Cisco
โœ… IBM
โœ… HP
โœ… Qualcomm
โœ… TCS
โœ… Infosys

๐Ÿ”— ๐—˜๐—ป๐—ฟ๐—ผ๐—น๐—น ๐—™๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜๐Ÿ‘‡:

https://pdlink.in/3SNiXKz

๐Ÿš€ Don't miss these FREE certification opportunities in 2026!
โค1
๐Ÿš€ ๐—ฃ๐—ฎ๐˜† ๐—”๐—ณ๐˜๐—ฒ๐—ฟ ๐—ฃ๐—น๐—ฎ๐—ฐ๐—ฒ๐—บ๐—ฒ๐—ป๐˜ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ - ๐—Ÿ๐—ฎ๐˜‚๐—ป๐—ฐ๐—ต ๐—ฌ๐—ผ๐˜‚๐—ฟ ๐—ง๐—ฒ๐—ฐ๐—ต ๐—–๐—ฎ๐—ฟ๐—ฒ๐—ฒ๐—ฟ

If youโ€™re serious about starting your career in tech, this is one opportunity you shouldnโ€™t miss ๐Ÿš€

โœ… 2000+ Students Already Placed
๐Ÿค 500+ Hiring Partners
๐Ÿ’ผ Salary: โ‚น7.4 LPA
๐Ÿš€ Highest Package: โ‚น41 LPA

๐Ÿ’ป Get trained in in-demand tech skills
๐Ÿ‘จโ€๐Ÿซ Learn from industry experts
๐Ÿ“ˆ Get dedicated placement support
๐Ÿ’ธ Pay only after you land a job

๐‘๐ž๐ ๐ข๐ฌ๐ญ๐ž๐ซ ๐๐จ๐ฐ ๐Ÿ‘‡:-

 https://pdlink.in/42WOE5H

Hurry! Limited seats are available.๐Ÿƒโ€โ™‚๏ธ
โค1
Which function is used to take input from the user in Python?
Anonymous Quiz
10%
A) print()
82%
B) input()
5%
C) read()
3%
D) scan()
โค1
What data type does the input() function return by default?
Anonymous Quiz
29%
A) int
9%
B) float
56%
C) str
6%
D) bool
โค1
Which function should you use to convert user input into an integer?
Anonymous Quiz
4%
A) str()
4%
B) float()
5%
C) bool()
88%
D) int()
โค5
Which is the recommended way to format strings in modern Python?
Anonymous Quiz
9%
A) % formatting
37%
B) .format()
50%
C) f-strings
5%
D) concat()
โค2
Hereโ€™s how luck finds you:

1. Work harder than expected 
2. Stay teachable
3. Give unselfishly
4. Read and write more
5. Show up on time
6. Quit complaining
7. Develop good manners
8. Be humble and show gratitude
9. Be kind and generous 
10. Surround yourself with smarter people
โค24
๐Ÿš€ ๐—ง๐—ผ๐—ฝ ๐Ÿฑ ๐—ฆ๐—ธ๐—ถ๐—น๐—น๐˜€ ๐—ง๐—ผ ๐— ๐—ฎ๐˜€๐˜๐—ฒ๐—ฟ ๐—œ๐—ป ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ โ€“ ๐—˜๐—ป๐—ฟ๐—ผ๐—น๐—น ๐—™๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜! ๐ŸŽ“

Want to build a high-paying, future-ready career? ๐Ÿ”ฅ Start learning the most in-demand skills:

๐Ÿ’ซ AI & ML :- https://pdlink.in/4phANS2
โ€‹
๐Ÿ“Š Data Analytics :- https://pdlink.in/4wh2ugB
โ€‹
๐Ÿ” Cyber Security :- https://pdlink.in/4wCW7DJ
โ€‹
โ˜๏ธ Cloud Computing :- https://pdlink.in/4yhBuie
โ€‹
๐Ÿ’ป Other Tech Skills :- https://pdlink.in/4peUslB
โ€‹
๐Ÿ“ข Share with your friends & college groups! ๐Ÿš€๐Ÿ”ฅ
โค3
๐Ÿš€ Data Science Roadmap 2026

๐Ÿ“˜ Phase 1: Programming Fundamentals

๐Ÿ Topic 4: Python Conditional Statements (if, elif, else)

Welcome back! ๐Ÿ‘‹

In the previous lesson, you learned how to take input from users and display output. Now it's time to learn how Python makes decisions.

Conditional statements allow a program to execute different blocks of code based on whether a condition is True or False.

They are one of the most important concepts in Python and are used extensively in Data Science, Machine Learning, and real-world applications.

๐Ÿ”น 1. What are Conditional Statements?

Conditional statements help Python decide which code should run based on a condition.

Think of it like making everyday decisions:

โ€ข If it's raining โ†’ Carry an umbrella.

โ€ข Else โ†’ Wear sunglasses.

Similarly, Python checks a condition and decides what to execute.

๐Ÿ”น 2. The "if" Statement

The "if" statement executes a block of code only if the condition is True.

Syntax

if condition:
# Code to execute


Example

age = 20
if age >= 18:
print("Eligible to vote")


Output

Eligible to vote


๐Ÿ”น 3. The "if...else" Statement

Use "else" when you want to execute another block if the condition is False.

Example

age = 16
if age >= 18:
print("Eligible to vote")
else:
print("Not eligible to vote")


Output

Not eligible to vote


๐Ÿ”น 4. The "if...elif...else" Statement โญ

Use "elif" when you need to check multiple conditions.

Example

marks = 85
if marks >= 90:
print("Grade A")
elif marks >= 75:
print("Grade B")
elif marks >= 60:
print("Grade C")
else:
print("Grade D")


Output

Grade B


Python checks conditions from top to bottom and executes the first condition that is True.

๐Ÿ”น 5. Nested "if" Statements

You can place one "if" statement inside another.

Example

age = 25
citizen = True
if age >= 18:
if citizen:
print("Eligible to vote")


Output

Eligible to vote


๐Ÿ”น 6. Using Logical Operators

Conditional statements often use logical operators.

"and"

age = 25
if age >= 18 and age <= 60:
print("Working Age")


"or"

marks = 35
if marks >= 40 or marks == 35:
print("Eligible for Grace Marks")


"not"

is_holiday = False
if not is_holiday:
print("Go to Office")


๐Ÿ”น 7. Checking Multiple Conditions

salary = 60000
experience = 4
if salary > 50000 and experience >= 3:
print("Eligible for Promotion")
else:
print("Not Eligible")


๐Ÿ”น 8. Ternary Operator โญ

A shorter way to write an "if...else" statement.

Syntax

value_if_true if condition else value_if_false


Example

age = 20
status = "Adult" if age >= 18 else "Minor"
print(status)


Output

Adult


๐Ÿ”น 9. Real-World Example

temperature = 38
if temperature > 35:
print("It's a hot day.")
elif temperature >= 20:
print("Weather is pleasant.")
else:
print("It's cold.")


๐Ÿ”น 10. Common Mistakes

โŒ Missing Colon

if age >= 18
print("Eligible")


This gives a SyntaxError.

Correct:
โค4๐Ÿ˜1
if age >= 18:
print("Eligible")


โŒ Incorrect Indentation

if age >= 18:
print("Eligible")


Python requires proper indentation.

Correct:

if age >= 18:
print("Eligible")


๐Ÿ”น 11. Real-World Data Science Example

prediction = 0.82
if prediction >= 0.5:
print("Spam Email")
else:
print("Not Spam")


Many Machine Learning classification models use similar logic to convert prediction probabilities into categories.

๐ŸŽฏ Practice Questions

1. Check whether a number is positive or negative.

2. Check whether a person is eligible to vote.

3. Create a grading system using "if...elif...else".

4. Check whether a number is even or odd.

5. Determine the largest of three numbers.

๐ŸŽฏ Key Takeaways

โœ… Use "if" to execute code when a condition is True.

โœ… Use "else" to execute code when the condition is False.

โœ… Use "elif" to check multiple conditions.

โœ… Nested "if" statements allow more complex decision-making.

โœ… Logical operators (and, or, not) help combine conditions.

โœ… The ternary operator provides a concise way to write simple "if...else" statements.

Conditional statements are the foundation of decision-making in Python and are widely used in automation, data analysis, machine learning, and AI applications.

Double Tap โค๏ธ For Part-5
โค11๐Ÿ˜ข1
๐Ÿš€ ๐—™๐—ฅ๐—˜๐—˜ ๐— ๐—ถ๐—ฐ๐—ฟ๐—ผ๐˜€๐—ผ๐—ณ๐˜ ๐—–๐—ฒ๐—ฟ๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ๐˜€ ๐Ÿ’ป๐Ÿ”ฅ

These FREE courses can help you learn Data Analytics, Power BI & Excel skills that companies actually hire for ๐Ÿš€

โœจ What youโ€™ll learn:
โœ” Excel + Power BI ๐Ÿ“Š
โœ” Data Cleaning with Power Query
โœ” Interactive Dashboards
โœ” Modern Analytics Skills

๐Ÿ’ฏ Beginner Friendly + FREE Learning

๐—˜๐—ป๐—ฟ๐—ผ๐—น๐—น ๐—™๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜๐Ÿ‘‡:-

https://pdlink.in/4tkPNyM

๐ŸŽ“ Perfect for Students, Freshers & Career Switchers
โค1๐Ÿ‘1
๐Ÿš€ Data Science Roadmap 2026

๐Ÿ“˜ Phase 1: Programming Fundamentals

๐Ÿ Topic 5: Python Loops ("for" & "while")

Welcome back! ๐Ÿ‘‹

In the previous lesson, you learned how Python makes decisions using if, elif, and else. Now it's time to learn how to repeat tasks automatically using loops.

Loops are one of the most powerful concepts in Python. Instead of writing the same code multiple times, you can use loops to execute a block of code repeatedly.

In Data Science, loops are commonly used to process datasets, automate repetitive tasks, iterate through lists, and build machine learning workflows.

๐Ÿ”น 1. What is a Loop?

A loop is used to execute a block of code multiple times until a condition is met.

Without loops:

print("Hello")
print("Hello")
print("Hello")
print("Hello")
print("Hello")


Using a loop:

for i in range(5):
print("Hello")


Both produce the same output, but the loop is much shorter and easier to maintain.

๐Ÿ”น 2. Types of Loops in Python

Python provides two main types of loops:

โœ… "for" Loop

โœ… "while" Loop

๐Ÿ”น 3. The "for" Loop โญ

A "for" loop is used when you know how many times you want to repeat a task.

Syntax

for variable in sequence:
# Code to execute


Example

for i in range(5):
print(i)


Output:

0  
1
2
3
4


Notice that range(5) generates numbers from 0 to 4.

๐Ÿ”น 4. The "range()" Function โญ

The range() function generates a sequence of numbers.

Example 1

for i in range(5):
print(i)


Output: 0 1 2 3 4

Example 2

for i in range(1, 6):
print(i)


Output: 1 2 3 4 5

Example 3

for i in range(2, 11, 2):
print(i)


Output: 2 4 6 8 10

The third argument is called the step size.

๐Ÿ”น 5. Looping Through a List

fruits = ["Apple", "Banana", "Mango"]

for fruit in fruits:
print(fruit)


Output:

Apple  
Banana
Mango


๐Ÿ”น 6. The "while" Loop โญ

A "while" loop continues executing as long as the condition remains True.

Syntax

while condition:
# Code


Example

count = 1

while count <= 5:
print(count)
count += 1


Output: 1 2 3 4 5

๐Ÿ”น 7. Infinite Loop

Be careful when using "while" loops.

while True:
print("Hello")


This loop never stops unless interrupted.

Always ensure the condition eventually becomes False.

๐Ÿ”น 8. Loop Control Statements โญ

"break" - Stops the loop immediately

for i in range(10):
if i == 5:
break
print(i)


Output: 0 1 2 3 4

"continue" - Skips the current iteration

for i in range(5):
if i == 2:
continue
print(i)


Output: 0 1 3 4

"pass" - Acts as a placeholder

for i in range(5):
pass


Useful when writing incomplete code.

๐Ÿ”น 9. Nested Loops

A loop inside another loop.

for i in range(3):
for j in range(2):
print(i, j)


Output:

0 0  
0 1
1 0
1 1
2 0
2 1


๐Ÿ”น 10. Real-World Data Science Example

Calculate the total sales.
โค4๐Ÿ‘1