-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtriangulo.py
More file actions
52 lines (40 loc) · 1.19 KB
/
Copy pathtriangulo.py
File metadata and controls
52 lines (40 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import time
import math
def menu(): #funcion menu (sus opciones)
print("(1) Ingresar largo de los lados del triangulo, ")
print("(2) calcular el perímetro del triángulo, ")
print("(3) calcular el área del triángulo")
print("(4) Salir")
def datos():
print("faltan datos")
opcion=0
while opcion !=4 :
menu()
opcion=int(input(":"))
if opcion== 1 :
print("ingrese 3 lados")
a=int(input())
b=int(input())
c=int(input())
menu()
opcion=int(input(":"))
if opcion==2 :
perimetro = a+b+c
print("el perimetro es", perimetro )
time.sleep(2)
elif opcion==3 :
s= (a+b+c)/2 #semiperimetro
h= s*(s-a)*(s-b)*(s-c) #formula de heron
area = math.sqrt(h) #math.sqrt es para sacar la raiz cuadrada
print( "el area es ", area )
time.sleep(2)
elif opcion == 2 :
datos()
time.sleep(2)
elif opcion == 3 :
datos()
time.sleep(2)
elif opcion == 4 :
print("saliendo")
time.sleep(2)
else : print("error")