Which keyword is used to check multiple conditions?
Anonymous Quiz
14%
A) elseif
60%
B) elif
22%
C) else if
4%
D) multiple
โค3
๐น Q4. What will be the output?
x = 7 if x > 10: print("A") elif x > 5: print("B") else: print("C")
x = 7 if x > 10: print("A") elif x > 5: print("B") else: print("C")
Anonymous Quiz
13%
A
77%
B
9%
C
1%
D
โค2
What will be the output?
age = 16 print("Adult") if age >= 18 else print("Minor")
age = 16 print("Adult") if age >= 18 else print("Minor")
Anonymous Quiz
24%
Adult
76%
Minor
โค5๐1
๐๐๐ฒ๐ ๐ง๐ผ๐ฝ ๐๐ฒ๐ฟ๐๐ถ๐ณ๐ถ๐ฐ๐ฎ๐๐ถ๐ผ๐ป๐ ๐๐๐ง's & ๐๐๐
Dreaming of studying at an IIT and building a career in AI ? This is your chance
โ Prestigious IIT Certification
โ Learn directly from IIT Professors
โ Placement Assistance with 5000+ Companies
๐ก Todayโs top companies are actively looking for professionals with AI skills.
๐ฅ๐ฒ๐ด๐ถ๐๐๐ฒ๐ฟ ๐ก๐ผ๐ ๐ :-
๐๐ & ๐๐ฎ๐๐ฎ ๐ฆ๐ฐ๐ถ๐ฒ๐ป๐ฐ๐ฒ :- https://pdlink.in/4kucM7E
๐๐ & ๐ ๐ฎ๐ฐ๐ต๐ถ๐ป๐ฒ ๐๐ฒ๐ฎ๐ฟ๐ป๐ถ๐ป๐ด :- https://pdlink.in/4rMivIA
๐๐ฎ๐๐ฎ ๐๐ป๐ฎ๐น๐๐๐ถ๐ฐ๐ ๐ช๐ถ๐๐ต ๐๐ :- https://pdlink.in/4ay4wPG
โณ Limited seats โ Register before the link expires!
Dreaming of studying at an IIT and building a career in AI ? This is your chance
โ Prestigious IIT Certification
โ Learn directly from IIT Professors
โ Placement Assistance with 5000+ Companies
๐ก Todayโs top companies are actively looking for professionals with AI skills.
๐ฅ๐ฒ๐ด๐ถ๐๐๐ฒ๐ฟ ๐ก๐ผ๐ ๐ :-
๐๐ & ๐๐ฎ๐๐ฎ ๐ฆ๐ฐ๐ถ๐ฒ๐ป๐ฐ๐ฒ :- https://pdlink.in/4kucM7E
๐๐ & ๐ ๐ฎ๐ฐ๐ต๐ถ๐ป๐ฒ ๐๐ฒ๐ฎ๐ฟ๐ป๐ถ๐ป๐ด :- https://pdlink.in/4rMivIA
๐๐ฎ๐๐ฎ ๐๐ป๐ฎ๐น๐๐๐ถ๐ฐ๐ ๐ช๐ถ๐๐ต ๐๐ :- https://pdlink.in/4ay4wPG
โณ Limited seats โ Register before the link expires!
โค2
Now, let's move to the next topic of Data Science Roadmap:
โ Python Dictionaries ๐
Dictionaries are one of the most important data structures in Python, especially in data science and real-world datasets. They store data in keyโvalue pairs.
๐น 1. What is a Dictionary?
A dictionary stores data in key:value format.
โ Example:
Output:
โ Uses curly brackets {}
๐น 2. Access Dictionary Values
Use the key to access values.
Output:
๐น 3. Add New Elements
Output:
๐น 4. Modify Values
๐น 5. Remove Elements
๐น 6. Important Dictionary Methods
โญ
โ Get Method:
Output:
โ Keys Method:
Output:
โ Values Method:
Output:
โ Items Method:
Output:
๐น 7. Loop Through Dictionary
Output:
name Rahul
age 22
๐ฏ Todayโs Goal
โ Understand keyโvalue pairs
โ Access dictionary values
โ Add or update data
โ Loop through dictionary
๐ Dictionaries are widely used in APIs, JSON data, and machine learning datasets.
Double Tap โฅ๏ธ For More
โ Python Dictionaries ๐
Dictionaries are one of the most important data structures in Python, especially in data science and real-world datasets. They store data in keyโvalue pairs.
๐น 1. What is a Dictionary?
A dictionary stores data in key:value format.
โ Example:
student = { "name": "Rahul", "age": 22, "course": "Data Science" }
print(student)
Output:
{'name': 'Rahul', 'age': 22, 'course': 'Data Science'}โ Uses curly brackets {}
๐น 2. Access Dictionary Values
Use the key to access values.
student = { "name": "Rahul", "age": 22 }
print(student["name"])
Output:
Rahul๐น 3. Add New Elements
student = { "name": "Rahul", "age": 22 }
student["city"] = "Delhi"
print(student)
Output:
{'name': 'Rahul', 'age': 22, 'city': 'Delhi'}๐น 4. Modify Values
student["age"] = 23
๐น 5. Remove Elements
student.pop("age")
๐น 6. Important Dictionary Methods
โญ
โ Get Method:
print(student.get("name"))
Output:
Rahulโ Keys Method:
print(student.keys())
Output:
dict_keys(['name', 'age'])โ Values Method:
print(student.values())
Output:
dict_values(['Rahul', 22])โ Items Method:
print(student.items())
Output:
dict_items([('name', 'Rahul'), ('age', 22)])๐น 7. Loop Through Dictionary
student = { "name": "Rahul", "age": 22 }
for key, value in student.items():
print(key, value)
Output:
name Rahul
age 22
๐ฏ Todayโs Goal
โ Understand keyโvalue pairs
โ Access dictionary values
โ Add or update data
โ Loop through dictionary
๐ Dictionaries are widely used in APIs, JSON data, and machine learning datasets.
Double Tap โฅ๏ธ For More
โค15๐ฅฐ1
Which symbol is used to create a dictionary in Python?
Anonymous Quiz
18%
A) []
8%
B) ()
71%
C) {}
3%
D) <>
โค1
What will be the output?
student = { "name": "Rahul", "age": 22 } print(student["name"])
student = { "name": "Rahul", "age": 22 } print(student["name"])
Anonymous Quiz
82%
A) Rahul
8%
B) name
3%
C) 22
7%
D) Error
โค1
Which method returns all keys of a dictionary?
Anonymous Quiz
12%
A) values()
12%
B) items()
64%
C) keys()
12%
D) get()
โค1
What will be the output?
data = {"a":1, "b":2} data["c"] = 3 print(data)
data = {"a":1, "b":2} data["c"] = 3 print(data)
Anonymous Quiz
9%
A) {'a':1, 'b':2}
66%
B) {'a':1, 'b':2, 'c':3}
18%
C) Error
7%
D) {'c':3}
โค1
Which method is used to remove an element from a dictionary?
Anonymous Quiz
43%
A) remove()
16%
B) delete()
36%
C) pop()
5%
D) clearitem()
โค7
Data Science Roadmap
โ Python File Handling
๐๐ File handling allows Python programs to read and write data from files.
๐ Very important in data science because most datasets come as:
โ CSV files
โ Text files
โ Logs
โ JSON files
๐น 1. Opening a File
Python uses the open() function.
Syntax:
Example:
๐ "r" โ Read mode
๐น 2. File Modes
- "r" โ Read file
- "w" โ Write file (overwrites existing content)
- "a" โ Append file (adds to existing content)
- "r+" โ Read and write
๐น 3. Reading a File
- Read Entire File:
- Read One Line:
- Read All Lines:
๐น 4. Writing to a File
โ "w" will overwrite existing content.
๐น 5. Append to File
โ Adds content without deleting old data.
๐น 6. Best Practice (Very Important โญ)
Use with statement.
โ Automatically closes the file.
๐น 7. Why File Handling is Important?
Used for:
โ Reading datasets
โ Saving results
โ Logging machine learning models
โ Data preprocessing
๐ฏ Todayโs Goal
โ Understand file modes
โ Read files
โ Write files
โ Use with open()
๐ File handling is used heavily when working with CSV datasets in data science.
Double Tap โฅ๏ธ For More
โ Python File Handling
๐๐ File handling allows Python programs to read and write data from files.
๐ Very important in data science because most datasets come as:
โ CSV files
โ Text files
โ Logs
โ JSON files
๐น 1. Opening a File
Python uses the open() function.
Syntax:
open("filename", "mode")Example:
file = open("data.txt", "r")๐ "r" โ Read mode
๐น 2. File Modes
- "r" โ Read file
- "w" โ Write file (overwrites existing content)
- "a" โ Append file (adds to existing content)
- "r+" โ Read and write
๐น 3. Reading a File
- Read Entire File:
file.read()- Read One Line:
file.readline()- Read All Lines:
file.readlines()๐น 4. Writing to a File
file = open("data.txt", "w")
file.write("Hello Data Science")
file.close()
โ "w" will overwrite existing content.
๐น 5. Append to File
file = open("data.txt", "a")
file.write("\nNew line added")
file.close()
โ Adds content without deleting old data.
๐น 6. Best Practice (Very Important โญ)
Use with statement.
with open("data.txt", "r") as file:
content = file.read()
print(content)
โ Automatically closes the file.
๐น 7. Why File Handling is Important?
Used for:
โ Reading datasets
โ Saving results
โ Logging machine learning models
โ Data preprocessing
๐ฏ Todayโs Goal
โ Understand file modes
โ Read files
โ Write files
โ Use with open()
๐ File handling is used heavily when working with CSV datasets in data science.
Double Tap โฅ๏ธ For More
โค10
Which function is used to open a file in Python?
Anonymous Quiz
8%
A) file()
62%
B) open()
21%
C) read()
10%
D) openfile()
โค2
โค2
What will the following code do?
file = open("data.txt", "w") file.write("Hello")
file = open("data.txt", "w") file.write("Hello")
Anonymous Quiz
5%
A) Reads file
2%
B) Deletes file
89%
C) Writes text to file
4%
D) Prints file content
โค1
Which method reads the entire file content?
Anonymous Quiz
10%
A) readline()
28%
B) readlines()
59%
C) read()
3%
D) get()
โค1
Why is the with open() statement preferred?
Anonymous Quiz
26%
A) It runs faster
55%
B) It automatically closes the file
4%
C) It deletes the file
15%
D) It prevents writing
โค2๐1๐ฅฐ1
โ
Python Exception Handling (tryโexcept) ๐โ ๏ธ
Exception handling helps programs handle errors gracefully instead of crashing.
๐ Very important in real-world applications and data processing.
๐น 1. What is an Exception?
An exception is an error that occurs during program execution.
Example:
Output: ZeroDivisionError
This will crash the program.
๐น 2. Using tryโexcept
We use tryโexcept to handle errors.
Syntax:
Example:
Output: Error occurred
๐น 3. Handling Specific Exceptions
โ Handles only ValueError.
๐น 4. Using else
else runs if no error occurs.
Output: No error
๐น 5. Using finally
finally always executes.
๐น 6. Common Python Exceptions
โข ZeroDivisionError: Division by zero
โข ValueError: Invalid value
โข TypeError: Wrong data type
โข FileNotFoundError: File does not exist
๐ฏ Today's Goal
โ Understand exceptions
โ Use tryโexcept
โ Handle specific errors
โ Use else and finally
๐ Exception handling is widely used in data pipelines and production code.
Double Tap โฅ๏ธ For More
Exception handling helps programs handle errors gracefully instead of crashing.
๐ Very important in real-world applications and data processing.
๐น 1. What is an Exception?
An exception is an error that occurs during program execution.
Example:
print(10 / 0)
Output: ZeroDivisionError
This will crash the program.
๐น 2. Using tryโexcept
We use tryโexcept to handle errors.
Syntax:
try:
# code that may cause error
except:
# code to handle error
Example:
try:
x = 10 / 0
except:
print("Error occurred")
Output: Error occurred
๐น 3. Handling Specific Exceptions
try:
num = int("abc")
except ValueError:
print("Invalid number")
โ Handles only ValueError.
๐น 4. Using else
else runs if no error occurs.
try:
x = 10 / 2
except:
print("Error")
else:
print("No error")
Output: No error
๐น 5. Using finally
finally always executes.
try:
file = open("data.txt")
except:
print("File not found")
finally:
print("Execution completed")
๐น 6. Common Python Exceptions
โข ZeroDivisionError: Division by zero
โข ValueError: Invalid value
โข TypeError: Wrong data type
โข FileNotFoundError: File does not exist
๐ฏ Today's Goal
โ Understand exceptions
โ Use tryโexcept
โ Handle specific errors
โ Use else and finally
๐ Exception handling is widely used in data pipelines and production code.
Double Tap โฅ๏ธ For More
โค8
SQL, or Structured Query Language, is a domain-specific language used to manage and manipulate relational databases. Here's a brief A-Z overview by @sqlanalyst
A - Aggregate Functions: Functions like COUNT, SUM, AVG, MIN, and MAX used to perform operations on data in a database.
B - BETWEEN: A SQL operator used to filter results within a specific range.
C - CREATE TABLE: SQL statement for creating a new table in a database.
D - DELETE: SQL statement used to delete records from a table.
E - EXISTS: SQL operator used in a subquery to test if a specified condition exists.
F - FOREIGN KEY: A field in a database table that is a primary key in another table, establishing a link between the two tables.
G - GROUP BY: SQL clause used to group rows that have the same values in specified columns.
H - HAVING: SQL clause used in combination with GROUP BY to filter the results.
I - INNER JOIN: SQL clause used to combine rows from two or more tables based on a related column between them.
J - JOIN: Combines rows from two or more tables based on a related column.
K - KEY: A field or set of fields in a database table that uniquely identifies each record.
L - LIKE: SQL operator used in a WHERE clause to search for a specified pattern in a column.
M - MODIFY: SQL command used to modify an existing database table.
N - NULL: Represents missing or undefined data in a database.
O - ORDER BY: SQL clause used to sort the result set in ascending or descending order.
P - PRIMARY KEY: A field in a table that uniquely identifies each record in that table.
Q - QUERY: A request for data from a database using SQL.
R - ROLLBACK: SQL command used to undo transactions that have not been saved to the database.
S - SELECT: SQL statement used to query the database and retrieve data.
T - TRUNCATE: SQL command used to delete all records from a table without logging individual row deletions.
U - UPDATE: SQL statement used to modify the existing records in a table.
V - VIEW: A virtual table based on the result of a SELECT query.
W - WHERE: SQL clause used to filter the results of a query based on a specified condition.
X - (E)XISTS: Used in conjunction with SELECT to test the existence of rows returned by a subquery.
Z - ZERO: Represents the absence of a value in numeric fields or the initial state of boolean fields.
A - Aggregate Functions: Functions like COUNT, SUM, AVG, MIN, and MAX used to perform operations on data in a database.
B - BETWEEN: A SQL operator used to filter results within a specific range.
C - CREATE TABLE: SQL statement for creating a new table in a database.
D - DELETE: SQL statement used to delete records from a table.
E - EXISTS: SQL operator used in a subquery to test if a specified condition exists.
F - FOREIGN KEY: A field in a database table that is a primary key in another table, establishing a link between the two tables.
G - GROUP BY: SQL clause used to group rows that have the same values in specified columns.
H - HAVING: SQL clause used in combination with GROUP BY to filter the results.
I - INNER JOIN: SQL clause used to combine rows from two or more tables based on a related column between them.
J - JOIN: Combines rows from two or more tables based on a related column.
K - KEY: A field or set of fields in a database table that uniquely identifies each record.
L - LIKE: SQL operator used in a WHERE clause to search for a specified pattern in a column.
M - MODIFY: SQL command used to modify an existing database table.
N - NULL: Represents missing or undefined data in a database.
O - ORDER BY: SQL clause used to sort the result set in ascending or descending order.
P - PRIMARY KEY: A field in a table that uniquely identifies each record in that table.
Q - QUERY: A request for data from a database using SQL.
R - ROLLBACK: SQL command used to undo transactions that have not been saved to the database.
S - SELECT: SQL statement used to query the database and retrieve data.
T - TRUNCATE: SQL command used to delete all records from a table without logging individual row deletions.
U - UPDATE: SQL statement used to modify the existing records in a table.
V - VIEW: A virtual table based on the result of a SELECT query.
W - WHERE: SQL clause used to filter the results of a query based on a specified condition.
X - (E)XISTS: Used in conjunction with SELECT to test the existence of rows returned by a subquery.
Z - ZERO: Represents the absence of a value in numeric fields or the initial state of boolean fields.
โค12๐1
โ
NumPy Basics ๐๐
NumPy (Numerical Python) is the most important library for numerical computing in Python.
It is widely used in:
โ Data Science
โ Machine Learning
โ AI
โ Scientific computing
๐น 1. What is NumPy?
NumPy provides a powerful data structure called NumPy Array. It is faster and more efficient than Python lists for mathematical operations.
Example:
๐น 2. Creating a NumPy Array
From a List
Output:
๐น 3. Check Array Type
Output:
๐น 4. NumPy Array Operations
Addition:
Output:
Multiplication:
Output:
๐น 5. NumPy Built-in Functions
Output:
๐น 6. NumPy Array Shape
Output:
Meaning: 2 rows and 3 columns.
๐น 7. Why NumPy is Important?
NumPy is the foundation of data science libraries:
โ Pandas
โ Scikit-Learn
โ TensorFlow
โ PyTorch
All these libraries use NumPy internally.
๐ฏ Today's Goal
โ Install NumPy
โ Create arrays
โ Perform math operations
โ Understand array shape
Double Tap โฅ๏ธ For More
NumPy (Numerical Python) is the most important library for numerical computing in Python.
It is widely used in:
โ Data Science
โ Machine Learning
โ AI
โ Scientific computing
๐น 1. What is NumPy?
NumPy provides a powerful data structure called NumPy Array. It is faster and more efficient than Python lists for mathematical operations.
Example:
import numpy as np
๐น 2. Creating a NumPy Array
From a List
import numpy as np
arr = np.array([1, 2, 3, 4])
print(arr)
Output:
[1 2 3 4]
๐น 3. Check Array Type
print(type(arr))
Output:
<class 'numpy.ndarray'>
๐น 4. NumPy Array Operations
Addition:
import numpy as np
arr = np.array([1, 2, 3])
print(arr + 2)
Output:
[3 4 5]
Multiplication:
print(arr * 2)
Output:
[2 4 6]
๐น 5. NumPy Built-in Functions
arr = np.array([10, 20, 30, 40])
print(arr.sum())
print(arr.mean())
print(arr.max())
print(arr.min())
Output:
100
25.0
40
10
๐น 6. NumPy Array Shape
arr = np.array([[1, 2, 3], [4, 5, 6]])
print(arr.shape)
Output:
(2, 3)
Meaning: 2 rows and 3 columns.
๐น 7. Why NumPy is Important?
NumPy is the foundation of data science libraries:
โ Pandas
โ Scikit-Learn
โ TensorFlow
โ PyTorch
All these libraries use NumPy internally.
๐ฏ Today's Goal
โ Install NumPy
โ Create arrays
โ Perform math operations
โ Understand array shape
Double Tap โฅ๏ธ For More
โค10๐2
๐๐ฟ๐ฒ๐๐ต๐ฒ๐ฟ๐ ๐๐ฎ๐ป ๐๐ฒ๐ ๐ฎ ๐ฏ๐ฌ ๐๐ฃ๐ ๐๐ผ๐ฏ ๐ข๐ณ๐ณ๐ฒ๐ฟ ๐๐ถ๐๐ต ๐๐ & ๐๐ฆ ๐๐ฒ๐ฟ๐๐ถ๐ณ๐ถ๐ฐ๐ฎ๐๐ถ๐ผ๐ป๐
IIT Roorkee offering AI & Data Science Certification Program
๐ซLearn from IIT ROORKEE Professors
โ Students & Fresher can apply
๐ IIT Certification Program
๐ผ 5000+ Companies Placement Support
Deadline: 22nd March 2026
๐ ๐ฅ๐ฒ๐ด๐ถ๐๐๐ฒ๐ฟ ๐ก๐ผ๐ ๐ :-
https://pdlink.in/4kucM7E
Big Opportunity, Do join asap!
IIT Roorkee offering AI & Data Science Certification Program
๐ซLearn from IIT ROORKEE Professors
โ Students & Fresher can apply
๐ IIT Certification Program
๐ผ 5000+ Companies Placement Support
Deadline: 22nd March 2026
๐ ๐ฅ๐ฒ๐ด๐ถ๐๐๐ฒ๐ฟ ๐ก๐ผ๐ ๐ :-
https://pdlink.in/4kucM7E
Big Opportunity, Do join asap!
โค3