Challenge: Creating and Using Methods
Compito
Swipe to start coding
Create a class that represents a rectangle and implements methods to calculate its area and perimeter.
- Define a class named
Rectangle. - Add an
__init__method that takeswidthandheightas arguments and stores them as instance variables. - Implement a method called
areathat returns the area of the rectangle. - Implement a method called
perimeterthat returns the perimeter of the rectangle.
Soluzione
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 1. Capitolo 5
single
Chieda ad AI
Chieda ad AI
Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione
Fantastico!
Completion tasso migliorato a 3.85
Challenge: Creating and Using Methods
Scorri per mostrare il menu
Compito
Swipe to start coding
Create a class that represents a rectangle and implements methods to calculate its area and perimeter.
- Define a class named
Rectangle. - Add an
__init__method that takeswidthandheightas arguments and stores them as instance variables. - Implement a method called
areathat returns the area of the rectangle. - Implement a method called
perimeterthat returns the perimeter of the rectangle.
Soluzione
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 1. Capitolo 5
single