-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTriangle_Data_calculator
More file actions
48 lines (45 loc) · 1.08 KB
/
Triangle_Data_calculator
File metadata and controls
48 lines (45 loc) · 1.08 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
from termcolor import colored,cprint
twenty = (colored("~~~~~~~~~~~~~~~~~~~~", 'yellow'))
import math
def triangle(a, b):
a2 = a*a
b2 = b*b
c2 = a2+b2
text = (colored("{a}^2 + {b}^2 = {c2}\n\na^2 + b^2 = c^2","blue")).format(a=a,b=b,c2=c2)
print(text)
print(twenty)
print(twenty)
print(twenty)
print(colored("C^ =","red"))
print(colored(c2,"blue"))
print(colored(c2,"blue"))
print(twenty)
print(twenty)
print(colored("SQUARE ROOT OF C =\n","red"))
sqrtc = math.sqrt(c2)
return(sqrtc)
print(colored("THANKS FOR SAYING THAT IT'S COOL","green"))
print(twenty)
print(twenty)
print(twenty)
print(twenty)
user = input(colored("enter something","yellow"))
print(twenty)
print(twenty)
print(twenty)
print("\n\n\n")
while True:
try:
print(colored(user,"blue"))
a2 = int(input(colored("ENTER A: ","red")))
print(twenty)
b2 = int(input(colored("ENTER B: ","red")))
print(twenty)
print(twenty)
print(triangle(a2,b2))
except ValueError:
print(twenty)
print(twenty)
print(colored("PLEASE TRY AGAIN WITH AN INTERGER(NO DECIMALS OR LETTERS)","green"))
print(twenty)
print(twenty)