-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstatt.py
73 lines (58 loc) · 1.84 KB
/
statt.py
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
from shapes import *
def statt():
triangles = get_tri()
rectangles = get_rec()
circles = get_cir()
#List where only the area of the shapes are saved
triA =[]
recA =[]
circA=[]
import re
import numpy as np
import matplotlib.pyplot as plt
while True:
print("\nAmount of calculations you have made so far:")
print("\tTriangles: ",len(triangles))
print("\tRectangles: ",len(rectangles))
print("\tCircles: ",len(circles))
print("\nAreas of your triangles:")
for i in triangles:
print("\t","%.2f" %i.area)
ta= int(i.area)
triA.append(ta)
if len(triA) >1:
t=plt.plot(triA,'mo')
plt.title("Triangle areas")
plt.ylabel("area")
plt.xlabel("triangle number")
plt.xticks(range(0, len(triA)))
plt.show(t)
print("\nAreas of your rectangles:")
for i in rectangles:
print("\t","%.2f" %i.area)
ra = int(i.area)
recA.append(ra)
if len(recA)>1:
r=plt.plot(recA,'ro')
plt.title("Rectangle areas")
plt.ylabel("area")
plt.xlabel("rectangle number")
plt.xticks(range(0, len(recA)))
plt.show(r)
print("\nAreas of your circles:")
for i in circles:
print("\t","%.2f" %i.area)
ca = int(i.area)
circA.append(ca)
if len(circA)>1:
c=plt.plot(circA,'ko')
plt.title("Circle areas")
plt.ylabel("area")
plt.xlabel("circle number")
plt.xticks(range(0, len(circA)))
plt.show(c)
ready=input("Press any key to go back to the main menu")
if re.match(r"[Oo][Kk]", ready):
break;
else:
break;