Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Challenge: Creating and Using Methods | Introdução à OOP em Python
Practice
Projects
Quizzes & Challenges
Questionários
Challenges
/
Programação Orientada a Objetos em Python

bookChallenge: 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 takes width and height as arguments and stores them as instance variables.
  • Implement a method called area that returns the area of the rectangle.
  • Implement a method called perimeter that returns the perimeter of the rectangle.

Solução

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 5
single

single

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

close

bookChallenge: 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 takes width and height as arguments and stores them as instance variables.
  • Implement a method called area that returns the area of the rectangle.
  • Implement a method called perimeter that returns the perimeter of the rectangle.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 5
single

single

some-alt