Data Science & Machine Learning
75.3K subscribers
798 photos
68 files
704 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
🎯 2026 IT Certification Prep Kit – Free!

🔥Whether you're preparing for #Python, #AI, #Cisco, #PMI, #Fortinet, #AWS, #Azure, #Excel, #comptia, #ITIL, #cloud or any other in-demand certification – SPOTO has got you covered!

What’s Inside:
・Free Python, Excel, Cyber Security, Cisco, SQL, ITIL, PMP, AWS courses: https://bit.ly/4cZ9PKA
・IT Certs E-book: https://bit.ly/4aQfbqc
・IT Exams Skill Test: https://bit.ly/4aQf3He
・Free AI material and support tools:https://bit.ly/4ucJoHO
・Free Cloud Study Guide: https://bit.ly/3OExOVB


👉 Become Part of Our IT Learning Circle! resources and support:
https://chat.whatsapp.com/Cnc5M5353oSBo3savBl397

💬 Want exam help? Chat with an admin now!
https://wa.link/0pjvhh
3
Which keyword is used to check a condition in Python?
Anonymous Quiz
9%
A) check
82%
B) if
4%
C) when
4%
D) condition
3
What will be the output?

x = 10 if x > 5: print("Yes") else: print("No")
Anonymous Quiz
89%
Yes
11%
No
3
Which keyword is used to check multiple conditions?
Anonymous Quiz
13%
A) elseif
60%
B) elif
23%
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")
Anonymous Quiz
13%
A
75%
B
10%
C
2%
D
2
What will be the output?

age = 16 print("Adult") if age >= 18 else print("Minor")
Anonymous Quiz
24%
Adult
76%
Minor
5😁1
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:

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
21🥰1
Which symbol is used to create a dictionary in Python?
Anonymous Quiz
18%
A) []
9%
B) ()
71%
C) {}
3%
D) <>
2😢1
What will be the output?

student = { "name": "Rahul", "age": 22 } print(student["name"])
Anonymous Quiz
82%
A) Rahul
9%
B) name
3%
C) 22
7%
D) Error
2
Which method returns all keys of a dictionary?
Anonymous Quiz
14%
A) values()
14%
B) items()
61%
C) keys()
11%
D) get()
1
What will be the output?

data = {"a":1, "b":2} data["c"] = 3 print(data)
Anonymous Quiz
9%
A) {'a':1, 'b':2}
65%
B) {'a':1, 'b':2, 'c':3}
18%
C) Error
8%
D) {'c':3}
1🤔1
Which method is used to remove an element from a dictionary?
Anonymous Quiz
43%
A) remove()
16%
B) delete()
35%
C) pop()
5%
D) clearitem()
8
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: 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
13
Which function is used to open a file in Python?
Anonymous Quiz
7%
A) file()
64%
B) open()
19%
C) read()
10%
D) openfile()
2
Which mode is used to read a file?
Anonymous Quiz
5%
A) "w"
3%
B) "a"
86%
C) "r"
6%
D) "rw"
2
What will the following code do?

file = open("data.txt", "w") file.write("Hello")
Anonymous Quiz
5%
A) Reads file
2%
B) Deletes file
90%
C) Writes text to file
4%
D) Prints file content
1
Which method reads the entire file content?
Anonymous Quiz
12%
A) readline()
27%
B) readlines()
58%
C) read()
3%
D) get()
1
Top Programming Languages for Beginners 👆
5👍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:
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
10