Ministério da Educação
Brasil um país de todos
Personal tools
Navigation
Log in


Forgot your password?
 
Document Actions

slides13-ex1.py

by Cicero Garrozi last modified 2015-11-20 03:36

Click here to get the file

Size 1 kB - File type text/python-source

File contents

class Triangulo:
    def __init__(self, A, B, C):
        self.ladoA = A
        self.ladoB = B
        self.ladoC = C

    def calculaPerimetro(self):
        return self.ladoA + self.ladoB + self.ladoC

    def getMaiorLado(self):
        return max(self.ladoA, self.ladoB, self.ladoC)

#programa principal:
print("Digite os tres lados do triangulo: ")
a = float(input("Lado A: "))
b = float(input("Lado B: "))
c = float(input("Lado C: "))
#criando o objeto triangulo
tri = Triangulo(a, b, c)
#imprimindo o perimetro:
print("O perimetro do triangulo e: ", tri.calculaPerimetro())
print("O maior lado do triangulo e: ", tri.getMaiorLado())


Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: