Bird
Raised Fist0

Which Python keyword is used to create a new class?

easy📝 Syntax Q12 of Q15
Python - Object-Oriented Programming Foundations
Which Python keyword is used to create a new class?
Adef
Bfunc
Cobject
Dclass
Step-by-Step Solution
Solution:
  1. Step 1: Recall Python syntax for defining classes

    In Python, the keyword class is used to define a new class.
  2. Step 2: Check other options

    def defines functions, object is a base class, and func is not a Python keyword.
  3. Final Answer:

    class -> Option D
  4. Quick Check:

    Use 'class' to define classes [OK]
Quick Trick: Classes start with 'class' keyword in Python [OK]
Common Mistakes:
MISTAKES
  • Using def instead of class for classes
  • Confusing object with class keyword
  • Trying to use func which is invalid

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes