Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Using init and self in Classes | Class Structures
Object Oriented Programming with Python
Section 1. Chapter 4
single

single

Challenge: Using init and self in Classes

Swipe to show menu

Task

Swipe to start coding

  • Define a class called Book.
  • The class should have an __init__ method that takes three parameters: self, title, and author.
  • Initialize the title and author attributes using self.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 4
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

some-alt