Python Data Science Jobs & Interviews
18K subscribers
141 photos
3 videos
5 files
252 links
Your go-to hub for Python and Data Science—featuring questions, answers, quizzes, and interview tips to sharpen your skills and boost your career in the data-driven world.

Admin: @Hussein_Sheikho
Download Telegram
🎯 Python Quick Quiz – OOP Edition
💡 _What is the primary use of the __init__ method in a Python class?_

🔘 Option 1: Initializing class attributes
🔘 Option 2: Defining class methods
🔘 Option 3: Inheriting from a superclass
🔘 Option 4: Handling exceptions

🧠 Correct Answer: Option 1
📌 The init method is a special method used to initialize the object’s attributes when a class is instantiated. It's like a constructor in other programming languages.
class Person:
def __init__(self, name, age):
self.name = name
self.age = age

john = Person("John", 25)
print(john.name) # Output: John


#PythonTips #OOP #PythonQuiz #CodingCommunity

🎨https://t.me/DataScienceQ
🔥42