Challenge: Creating and Using Methods
Tarefa
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.
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 1. Capítulo 5
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Incrível!
Completion taxa melhorada para 3.85
Challenge: Creating and Using Methods
Deslize para mostrar o menu
Tarefa
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.
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 1. Capítulo 5
single