-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappenderasad
125 lines (80 loc) · 2.8 KB
/
appenderasad
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import time
t=time
print("Wellcome to max area generator with fixed parameter")
print(" You will need to provide the value for P/2 in the equation x + y = P/2")
print("X and Y will be the possible lenghts and breaths which we can use to form paramemter")
print("You will also need to input a value for number of loops. More loops means smaller incriments and more time")
#Make an if else statement if they understand if yes continue if no restart program
loopamt = int(input("How many loops you want?"))
halfperi = int(input("What is half of the perimeter (L+B)??"))
diff = 0
area = 0
finarea=[]
diffchange = halfperi / loopamt
loopnum = 0
print("Out of loop")
print("Initial x values is P/2 which is basically = " + str(halfperi))
print("Initial y values is 0")
print("You want " + str(loopamt) + " which means we will have an incriment of " + str(diffchange))
amogus = str(input("Do u want to see loopdata(varible per loop)? - type 'ok' "))
print(" ")
t.sleep(5)
while diff <= halfperi :
print("START OF LOOP:" + str(loopnum) )
x = halfperi-diff
y = 0+diff
area=x*y
finarea.append(area)
if amogus == "ok" :
print("In loop varible check")
print("Current x value" + str(x))
print("Current y value" + str(y))
print("Current difference" + str(diff))
if x > y:
print("When x is greater than y by:")
print(x-y)
elif x == y:
print("When x and y are same at a value of:"+ str(x))
else:
print("When y is greater than x by:")
print(y-x)
print("Area is = " + str(area))
print(finarea)
else:
print("Data stored but not printed")
t.sleep(0.1)
print("END OF LOOP " + str(loopnum))
diff = diff + diffchange
loopnum = loopnum + 1
print(" ")
t.sleep(0.1)
print("Final varible check")
print(x)
print(y)
print("list of areas")
print(finarea)
maxarea = max(finarea)
print("Max value is " + str(maxarea))
moreinfo = input("You want more information? y/n")
if moreinfo == "y" :
print("Max value is " + str(maxarea))
print("Max value at loop # " + str(finarea.index(maxarea)))
specificxval = halfperi - ((finarea.index(maxarea)*diffchange))
print("x value is " + str(specificxval))
specificyval = 0 + ((finarea.index(maxarea)*diffchange))
print("y value is " + str(specificyval))
else:
print("Ok")
print("bye")
wannare = str(input("Wanna restart program? y/n"))
if wannare == "y":
def restart():
import sys
print("argv was",sys.argv)
print("sys.executable was", sys.executable)
print("restart now")
import os
os.execv(sys.executable, ['python'] + sys.argv)
restart()
else:
print("bye")