๐๐ฎ๐๐ฎ ๐ฆ๐ฐ๐ถ๐ฒ๐ป๐ฐ๐ฒ ๐๐ฅ๐๐ ๐ข๐ป๐น๐ถ๐ป๐ฒ ๐ ๐ฎ๐๐๐ฒ๐ฟ๐ฐ๐น๐ฎ๐๐ ๐
๐ซ Know The Tools, Skills & Mindset to Land your first Job
โ
๐ซUnderstand the Foundations, tools, skills & the core essentials that you need to excel in the Data Science domain.
Eligibility :- Students ,Freshers & Working Professionals
๐ฅ๐ฒ๐ด๐ถ๐๐๐ฒ๐ฟ ๐๐ผ๐ฟ ๐๐ฅ๐๐๐ :-
https://pdlink.in/4btjs2G
( Limited Slots ..Hurry Upโ )
Date & Time :- 17th July 2026 , 7:00 PM
๐ซ Know The Tools, Skills & Mindset to Land your first Job
โ
๐ซUnderstand the Foundations, tools, skills & the core essentials that you need to excel in the Data Science domain.
Eligibility :- Students ,Freshers & Working Professionals
๐ฅ๐ฒ๐ด๐ถ๐๐๐ฒ๐ฟ ๐๐ผ๐ฟ ๐๐ฅ๐๐๐ :-
https://pdlink.in/4btjs2G
( Limited Slots ..Hurry Upโ )
Date & Time :- 17th July 2026 , 7:00 PM
โค3๐ข1
๐ ๐ฒ ๐ ๐๐๐-๐ง๐ฎ๐ธ๐ฒ ๐๐ผ๐๐ฟ๐๐ฒ๐ ๐ง๐ผ ๐จ๐ฝ๐ด๐ฟ๐ฎ๐ฑ๐ฒ ๐ฌ๐ผ๐๐ฟ ๐ฅ๐ฒ๐๐๐บ๐ฒ ๐๐ข๐ฅ ๐๐ฅ๐๐
Make your resume stand out to recruiters without spending a single rupee
โ 100% FREE Learning
โ Free Certificates
โ Beginner-Friendly
โ Self-Paced Learning
โ Resume & LinkedIn Boost
โ Industry-Relevant Skills
๐๐ป๐ฟ๐ผ๐น๐น ๐๐ผ๐ฟ ๐๐ฅ๐๐๐:-
https://pdlink.in/3Rmbzp1
๐ Learn for Free. Get Certified. Upgrade Your Resume. Land Your Dream Job!
Make your resume stand out to recruiters without spending a single rupee
โ 100% FREE Learning
โ Free Certificates
โ Beginner-Friendly
โ Self-Paced Learning
โ Resume & LinkedIn Boost
โ Industry-Relevant Skills
๐๐ป๐ฟ๐ผ๐น๐น ๐๐ผ๐ฟ ๐๐ฅ๐๐๐:-
https://pdlink.in/3Rmbzp1
๐ Learn for Free. Get Certified. Upgrade Your Resume. Land Your Dream Job!
โค5๐1
Which loop is generally used when you know the number of iterations in advance?
Anonymous Quiz
17%
A) while loop
60%
B) for loop
16%
C) do-while loop
7%
D) Infinite loop
โค3
Which keyword is used to immediately terminate a loop?
Anonymous Quiz
7%
A) continue
8%
B) pass
78%
C) break
7%
D) exit
โค2
Which statement about the while loop is correct?
Anonymous Quiz
3%
A) It always runs exactly 10 times.
7%
B) It executes only once.
86%
C) It continues executing as long as the condition is True.
3%
D) It can only be used with lists.
โค3
What is the output of the following code?
total = 0
for i in range(1, 4): total += i print(total)
total = 0
for i in range(1, 4): total += i print(total)
Anonymous Quiz
22%
3
36%
6
27%
10
15%
5
โค2๐ฅฐ1
Data is the fuel but AI is the Machinery.
The people who know how to use both will lead the future.
Become one with TiHAN IIT Hyderabad's AI & ML Program.
โ Learn live from TiHAN scientists, IIT professors & industry experts
โ Build hands-on projects with Flipkart & Mamaearth
โ Assured interview at TiHAN IIT Hyderabad with 9+ CGPA
โ Placement support across 5000+ companies through Masai
Online Entrance Exam: 19th July
๐ Register: https://tinyurl.com/datasimplifier-17jul-tihan-006
The people who know how to use both will lead the future.
Become one with TiHAN IIT Hyderabad's AI & ML Program.
โ Learn live from TiHAN scientists, IIT professors & industry experts
โ Build hands-on projects with Flipkart & Mamaearth
โ Assured interview at TiHAN IIT Hyderabad with 9+ CGPA
โ Placement support across 5000+ companies through Masai
Online Entrance Exam: 19th July
๐ Register: https://tinyurl.com/datasimplifier-17jul-tihan-006
โค4
Data Science & Machine Learning
Data is the fuel but AI is the Machinery. The people who know how to use both will lead the future. Become one with TiHAN IIT Hyderabad's AI & ML Program. โ
Learn live from TiHAN scientists, IIT professors & industry experts โ
Build hands-on projects withโฆ
Final 6 Hours Left!
To register for TiHAN IIT Hyderabad's AI & ML Program.
Don't miss your chance to:
โข Learn from India's best scientists at TiHAN, IIT Professors and industry experts
โข Direct Interview at TiHAN IIT Hyderabad with 9+ CGPA
Register before the Admission Closes!
To register for TiHAN IIT Hyderabad's AI & ML Program.
Don't miss your chance to:
โข Learn from India's best scientists at TiHAN, IIT Professors and industry experts
โข Direct Interview at TiHAN IIT Hyderabad with 9+ CGPA
Register before the Admission Closes!
โค2
๐ Data Science Roadmap 2026
๐ Phase 1: Programming Fundamentals
๐ Topic 6: Python Functions
So far, you've learned variables, operators, input/output, conditional statements, and loops. As your programs grow larger, writing the same code repeatedly becomes inefficient. That's where functions come in.
A function is a reusable block of code that performs a specific task. Functions make your code cleaner, easier to maintain, and reusable.
Functions are heavily used in Data Science, Machine Learning, and AI because they allow you to organize complex workflows into smaller, manageable pieces.
๐น 1. What is a Function?
A function is a named block of code that executes only when it is called.
Instead of writing the same logic multiple times, you write it once inside a function and reuse it whenever needed.
Example
Output
๐น 2. Why Do We Use Functions?
Functions help you:
โ Avoid writing duplicate code
โ Improve code readability
โ Make debugging easier
โ Reuse code in multiple places
โ Build modular applications
๐น 3. Defining a Function
Syntax
Example:
๐น 4. Function Parameters
Parameters allow you to pass information into a function.
Output
Here, "name" is called a parameter.
๐น 5. Function Arguments
When calling a function, the values you pass are called arguments.
Output
Here:
โข "number" โ Parameter
โข "5" โ Argument
๐น 6. Returning Values
A function can return a value using the return keyword.
Output
Using return allows the function's result to be stored or used later.
๐น 7. Default Parameters
You can assign default values to parameters.
Output
๐น 8. Multiple Return Values
A function can return more than one value.
Output
๐น 9. Scope of Variables
Variables created inside a function are called local variables.
Trying to access
outside the function will produce an error because it exists only inside the function.
๐น 10. Built-in Functions
Python provides many ready-to-use functions.
Examples:
Output
๐น 11. Real-World Data Science Example
Calculate the average marks of students.
Output
Functions like this are commonly used while cleaning data, calculating statistics, and building machine learning pipelines.
๐น 12. Common Mistakes
โ Forgetting to Call the Function
Correct:
โ Forgetting to Return a Value
๐ฏ Practice Questions
1. Write a function to add two numbers.
2. Create a function to calculate the square of a number.
3. Write a function that checks whether a number is even or odd.
4. Create a function to calculate the average of a list.
5. Write a function that returns the largest of three numbers.
Double Tap โค๏ธ For Part-7
๐ Phase 1: Programming Fundamentals
๐ Topic 6: Python Functions
So far, you've learned variables, operators, input/output, conditional statements, and loops. As your programs grow larger, writing the same code repeatedly becomes inefficient. That's where functions come in.
A function is a reusable block of code that performs a specific task. Functions make your code cleaner, easier to maintain, and reusable.
Functions are heavily used in Data Science, Machine Learning, and AI because they allow you to organize complex workflows into smaller, manageable pieces.
๐น 1. What is a Function?
A function is a named block of code that executes only when it is called.
Instead of writing the same logic multiple times, you write it once inside a function and reuse it whenever needed.
Example
def greet():
print("Welcome to Data Science!")
greet()
Output
Welcome to Data Science!
๐น 2. Why Do We Use Functions?
Functions help you:
โ Avoid writing duplicate code
โ Improve code readability
โ Make debugging easier
โ Reuse code in multiple places
โ Build modular applications
๐น 3. Defining a Function
Syntax
def function_name():
# Function body
Example:
def welcome():
print("Hello, World!")
welcome()
๐น 4. Function Parameters
Parameters allow you to pass information into a function.
def greet(name):
print("Hello", name)
greet("Deepak")
Output
Hello Deepak
Here, "name" is called a parameter.
๐น 5. Function Arguments
When calling a function, the values you pass are called arguments.
def square(number):
print(number * number)
square(5)
Output
25
Here:
โข "number" โ Parameter
โข "5" โ Argument
๐น 6. Returning Values
A function can return a value using the return keyword.
def add(a, b):
return a + b
result = add(10, 20)
print(result)
Output
30
Using return allows the function's result to be stored or used later.
๐น 7. Default Parameters
You can assign default values to parameters.
def greet(name="Guest"):
print("Hello", name)
greet()
greet("Rahul")
Output
Hello Guest
Hello Rahul
๐น 8. Multiple Return Values
A function can return more than one value.
def calculate(a, b):
return a + b, a * b
sum_value, product = calculate(4, 5)
print(sum_value)
print(product)
Output
9
20
๐น 9. Scope of Variables
Variables created inside a function are called local variables.
def demo():
message = "Inside Function"
print(message)
demo()
Trying to access
message
outside the function will produce an error because it exists only inside the function.
๐น 10. Built-in Functions
Python provides many ready-to-use functions.
Examples:
numbers = [5, 2, 8, 1]
print(len(numbers))
print(max(numbers))
print(min(numbers))
print(sum(numbers))
Output
4
8
1
16
๐น 11. Real-World Data Science Example
Calculate the average marks of students.
def average(marks):
return sum(marks) / len(marks)
scores = [80, 75, 92, 88]
print(average(scores))
Output
83.75
Functions like this are commonly used while cleaning data, calculating statistics, and building machine learning pipelines.
๐น 12. Common Mistakes
โ Forgetting to Call the Function
def greet():
print("Hello")
# Nothing happens because the function isn't called.
Correct:
greet()
โ Forgetting to Return a Value
def add(a, b):
a + b
# Correct:
def add(a, b):
return a + b
๐ฏ Practice Questions
1. Write a function to add two numbers.
2. Create a function to calculate the square of a number.
3. Write a function that checks whether a number is even or odd.
4. Create a function to calculate the average of a list.
5. Write a function that returns the largest of three numbers.
Double Tap โค๏ธ For Part-7
โค14
๐ ๐๐ฎ๐๐ฎ ๐๐ป๐ฎ๐น๐๐๐ถ๐ฐ๐ ๐๐ฅ๐๐ ๐๐ฒ๐ฟ๐๐ถ๐ณ๐ถ๐ฐ๐ฎ๐๐ถ๐ผ๐ป ๐๐ผ๐๐ฟ๐๐ฒ๐
Data Analytics is one of the most in-demand skills in todayโs job market ๐ป
โ Beginner Friendly
โ Industry-Relevant Curriculum
โ Certification Included
โ 100% Online
๐๐ป๐ฟ๐ผ๐น๐น ๐๐ผ๐ฟ ๐๐ฅ๐๐๐:-
https://pdlink.in/4wh2ugB
๐ฏ Donโt miss this opportunity to build high-demand skills!
Data Analytics is one of the most in-demand skills in todayโs job market ๐ป
โ Beginner Friendly
โ Industry-Relevant Curriculum
โ Certification Included
โ 100% Online
๐๐ป๐ฟ๐ผ๐น๐น ๐๐ผ๐ฟ ๐๐ฅ๐๐๐:-
https://pdlink.in/4wh2ugB
๐ฏ Donโt miss this opportunity to build high-demand skills!
โค1
Which keyword is used to define a function in Python?
Anonymous Quiz
8%
A) function
84%
B) def
7%
C) func
1%
D) define
โค1
Which keyword is used to return a value from a function?
Anonymous Quiz
3%
A) break
12%
B) print
83%
C) return
2%
D) pass
โค1
Which of the following is a built-in Python function?
Anonymous Quiz
15%
A) calculate()
15%
B) average()
64%
C) sum()
7%
D) multiply()
โค2
What will be the output of the following code?
def multiply(a, b):
return a * b print(multiply(4, 5))
def multiply(a, b):
return a * b print(multiply(4, 5))
Anonymous Quiz
7%
9
93%
20
โค1๐ฅฐ1
What will be the output of the following code?
def greet(): print("Hello") greet()
def greet(): print("Hello") greet()
Anonymous Quiz
91%
Hello
9%
greet
โค3
๐ ๐๐ & ๐ ๐ฎ๐ฐ๐ต๐ถ๐ป๐ฒ ๐๐ฒ๐ฎ๐ฟ๐ป๐ถ๐ป๐ด ๐๐ฅ๐๐ ๐๐ฒ๐ฟ๐๐ถ๐ณ๐ถ๐ฐ๐ฎ๐๐ถ๐ผ๐ป ๐๐ผ๐๐ฟ๐๐ฒ๐ฅ
Learn the most in-demand AI skills from scratch and strengthen your profile with industry-recognized certificates! ๐
โ Beginner-Friendly Courses
โ Learn Online at Your Own Pace
โ 100% FREE of cost
Perfect for Students, Freshers & Working Professionals looking to build a career in AI/ML. ๐ผ
๐๐ป๐ฟ๐ผ๐น๐น ๐๐ผ๐ฟ ๐๐ฅ๐๐๐:-
https://pdlink.in/4phANS2
๐ข Share this with your friends who want to start their AI career!
Learn the most in-demand AI skills from scratch and strengthen your profile with industry-recognized certificates! ๐
โ Beginner-Friendly Courses
โ Learn Online at Your Own Pace
โ 100% FREE of cost
Perfect for Students, Freshers & Working Professionals looking to build a career in AI/ML. ๐ผ
๐๐ป๐ฟ๐ผ๐น๐น ๐๐ผ๐ฟ ๐๐ฅ๐๐๐:-
https://pdlink.in/4phANS2
๐ข Share this with your friends who want to start their AI career!
โค1
๐ Data Science Roadmap 2026
๐ Phase 1: Programming Fundamentals
๐ Topic 7: Python Data Structures (Lists, Tuples, Sets & Dictionaries)
Welcome back! ๐
So far, you've learned variables, operators, input/output, conditional statements, loops, and functions. Now it's time to learn one of the most important topics in Pythonโ Data Structures.
Data structures help us store, organize, and manage data efficiently. In Data Science, almost every dataset you work with will be stored or manipulated using these structures.
Python provides four built-in data structures:
โข List
โข Tuple
โข Set
โข Dictionary
Let's understand each one in detail.
๐น 1. List
A List is an ordered, mutable collection that allows duplicate values.
Creating a List
Output
Accessing Elements
Output
Modifying a List
Output
Adding Elements
Removing Elements
๐น 2. Tuple
A Tuple is an ordered collection that cannot be modified after creation (immutable).
Creating a Tuple
Accessing Elements
Output
Why Use Tuples?
Use tuples when your data should never change.
Examples:
โข Months of the year
โข Days of the week
โข Fixed coordinates
๐น 3. Set
A Set is an unordered collection of unique elements.
Duplicate values are automatically removed.
Creating a Set
Output
Adding Elements
Removing Elements
Common Uses
โข Remove duplicates
โข Membership testing
โข Mathematical set operations
๐น 4. Dictionary โญ
A Dictionary stores data as key-value pairs.
It is one of the most frequently used data structures in Data Science.
Creating a Dictionary
Accessing Values
Output
Adding a New Key
Updating a Value
Removing a Key
๐น 5. Comparison of Data Structures
Feature | List | Tuple | Set | Dictionary
Ordered | โ | โ | โ | โ
Mutable | โ | โ | โ | โ
Duplicates Allowed | โ | โ | โ | Keys โ
Indexed | โ | โ | โ | By Key
๐น 6. Common List Methods
๐น 7. Common Dictionary Methods
๐ Phase 1: Programming Fundamentals
๐ Topic 7: Python Data Structures (Lists, Tuples, Sets & Dictionaries)
Welcome back! ๐
So far, you've learned variables, operators, input/output, conditional statements, loops, and functions. Now it's time to learn one of the most important topics in Pythonโ Data Structures.
Data structures help us store, organize, and manage data efficiently. In Data Science, almost every dataset you work with will be stored or manipulated using these structures.
Python provides four built-in data structures:
โข List
โข Tuple
โข Set
โข Dictionary
Let's understand each one in detail.
๐น 1. List
A List is an ordered, mutable collection that allows duplicate values.
Creating a List
fruits = ["Apple", "Banana", "Mango"]
print(fruits)
Output
['Apple', 'Banana', 'Mango']
Accessing Elements
print(fruits[0])
print(fruits[2])
Output
Apple
Mango
Modifying a List
fruits[1] = "Orange"
print(fruits)
Output
['Apple', 'Orange', 'Mango']
Adding Elements
fruits.append("Grapes")
print(fruits)Removing Elements
fruits.remove("Orange")
print(fruits)๐น 2. Tuple
A Tuple is an ordered collection that cannot be modified after creation (immutable).
Creating a Tuple
colors = ("Red", "Green", "Blue")
print(colors)Accessing Elements
print(colors[1])
Output
Green
Why Use Tuples?
Use tuples when your data should never change.
Examples:
โข Months of the year
โข Days of the week
โข Fixed coordinates
๐น 3. Set
A Set is an unordered collection of unique elements.
Duplicate values are automatically removed.
Creating a Set
numbers = {1, 2, 2, 3, 4, 4, 5}
print(numbers)Output
{1, 2, 3, 4, 5}Adding Elements
numbers.add(6)
Removing Elements
numbers.remove(3)
Common Uses
โข Remove duplicates
โข Membership testing
โข Mathematical set operations
๐น 4. Dictionary โญ
A Dictionary stores data as key-value pairs.
It is one of the most frequently used data structures in Data Science.
Creating a Dictionary
student = {
"name": "Deepak",
"age": 24,
"course": "Data Science"
}
print(student)Accessing Values
print(student["name"])
Output
Deepak
Adding a New Key
student["city"] = "Mumbai"
Updating a Value
student["age"] = 25
Removing a Key
del student["course"]
๐น 5. Comparison of Data Structures
Feature | List | Tuple | Set | Dictionary
Ordered | โ | โ | โ | โ
Mutable | โ | โ | โ | โ
Duplicates Allowed | โ | โ | โ | Keys โ
Indexed | โ | โ | โ | By Key
๐น 6. Common List Methods
numbers = [10, 20, 30]
numbers.append(40)
numbers.insert(1, 15)
numbers.remove(20)
numbers.sort()
print(numbers)
๐น 7. Common Dictionary Methods
โค3
student = {
"name": "Rahul",
"age": 23
}
print(student.keys())
print(student.values())
print(student.items())๐น 8. Real-World Data Science Example
Suppose you have student information.
students = [
{"name": "Amit", "marks": 90},
{"name": "Sara", "marks": 85}
]
for student in students:
print(student["name"], student["marks"])
Output
Amit 90
Sara 85
This is very similar to how records are stored before converting them into a Pandas DataFrame.
๐น 9. Common Mistakes
โ Trying to Modify a Tuple
colors = ("Red", "Green")
colors[0] = "Blue"This raises a
TypeError because tuples are immutable.โ Accessing a Missing Dictionary Key
student = {"name": "John"}
print(student["age"])This raises a
KeyError.A safer approach:
print(student.get("age"))๐ฏ Practice Questions
1. Create a list of five cities and print the third city.
2. Create a tuple containing the days of the week.
3. Remove duplicate numbers from a list using a set.
4. Create a dictionary containing your name, age, and profession.
5. Print all keys and values of a dictionary using a loop.
๐ฏ Key Takeaways
โ Lists are ordered and mutable.
โ Tuples are ordered and immutable.
โ Sets store only unique values.
โ Dictionaries store data as key-value pairs.
โ Dictionaries and Lists are the most commonly used data structures in Data Science.
Mastering these four data structures will make it much easier to work with datasets, APIs, JSON files, and machine learning projects.
Double Tap โค๏ธ For Part-8
โค8
๐ ๐๐ถ๐๐ฐ๐ผ ๐๐ฅ๐๐ ๐ง๐ฒ๐ฐ๐ต ๐๐ผ๐๐ฟ๐๐ฒ๐ | ๐ฑ ๐ ๐๐๐-๐๐ผ ๐๐ผ๐๐ฟ๐๐ฒ๐ ๐
Cisco offers learning opportunities covering some of the most valuable foundations for careers in Cybersecurity, Networking, Linux and IoT.
โ Beginner-Friendly Tech Skills
โ Learn In-Demand IT Concepts
โ Build Practical Knowledge
โ Strengthen Your Resume
โ Great for Students & Freshers
๐๐ป๐ฟ๐ผ๐น๐น ๐๐ผ๐ฟ ๐๐ฅ๐๐๐:-
https://pdlink.in/4fhCSKo
๐ฅ Learn from Cisco โข Build Skills โข Upgrade Your Resume โข Get Career-Ready!
Cisco offers learning opportunities covering some of the most valuable foundations for careers in Cybersecurity, Networking, Linux and IoT.
โ Beginner-Friendly Tech Skills
โ Learn In-Demand IT Concepts
โ Build Practical Knowledge
โ Strengthen Your Resume
โ Great for Students & Freshers
๐๐ป๐ฟ๐ผ๐น๐น ๐๐ผ๐ฟ ๐๐ฅ๐๐๐:-
https://pdlink.in/4fhCSKo
๐ฅ Learn from Cisco โข Build Skills โข Upgrade Your Resume โข Get Career-Ready!
โค1
Which Python data structure is ordered, mutable, and allows duplicate values?
Anonymous Quiz
9%
A) Set
23%
B) Tuple
60%
C) List
8%
D) Dictionary
๐2โค1
Which data structure stores only unique elements?
Anonymous Quiz
8%
A) List
29%
B) Tuple
45%
C) Set
18%
D) Dictionary
๐2โค1