-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpitagoras.py
More file actions
46 lines (38 loc) · 1.04 KB
/
pitagoras.py
File metadata and controls
46 lines (38 loc) · 1.04 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
#-*- coding: utf-8 -*-
import math;
def programa():
print
print "Programa que calcula la hipotenusa:"
print "ingrese los lados de un triangulo rectangulo"
print "(si no ingresas nada por defecto sera 1 unidad)"
print
b=(raw_input("ingrese lado b: "));
c=(raw_input("ingrese lado c: "));
if b=="":
b=1.0;
if c=="":
c=1.0;
b2=math.pow((float)(b),2);
c2=math.pow((float)(c),2);
br=math.sqrt(b2);
cr=math.sqrt(c2);
print
print "/////////////////resultado.////////////////////"
print
print "a^2 = b^2 + c^2"
print
print "a","^2 =",b,"^2 +",c,"^2"
print
print "a^2", "=", b2 , "+", c2
print
print "a","= raiz de(",b2,"+",c2,")"
print
print "a", "=", br, "+", cr
print
print "a =",br+cr
print "///////////////////////////////////////////////////"
print
r=(raw_input("Quiere volver a correr el programa? (S/n)"))
if r=="S" or r=="SI" or r=="s" or r=="si":
programa();
programa();