-4
def main():
base = input("digite o valor da base do triangulo: ")
altura = input("digite o valor da altura do triangulo: ")
area = ((base*altura)/2)
return area
main()
-4
def main():
base = input("digite o valor da base do triangulo: ")
altura = input("digite o valor da altura do triangulo: ")
area = ((base*altura)/2)
return area
main()
2
You can create a function that returns the area calculation and then you can print the function
def calcularArea(base, altura):
area = ((base * altura) / 2)
return area
def main():
base = int(input("digite o valor da base do triangulo: "))
altura = int(input("digite o valor da altura do triangulo: "))
print(calcularArea(base, altura))
main()
I tried to do it this way but it’s returning error
I forgot to convert to integers in input, edited the answer with the correction
The input, by default, only accepts string, if you want to use int or float you must do the type conversion in input
Browser other questions tagged python-3.x
You are not signed in. Login or sign up in order to post.
It would be interesting to better describe your question, so you make the question easier to understand and more people can answer your question
– Juliana Marques