-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
33 lines (24 loc) · 869 Bytes
/
test.py
File metadata and controls
33 lines (24 loc) · 869 Bytes
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
import csv
def get_cell(x,y):
with open('microsoft-DataAnalysis.csv', 'r') as f:
reader = csv.reader(f)
y_count = 0
for n in reader:
if y_count == y:
cell = n[x]
return cell
y_count +=1
datapoint = int(input('Please enter datapoint'))
investment = int(input('Please enter investment'))
unsort_returnlist = []
for i in range(1, datapoint+1):
unsort_returnlist.append(get_cell(7,i))
unsort_returnfloat = [float(x) for x in unsort_returnlist]
sort_return = sorted(unsort_returnfloat)
Total = len(sort_return)
His_Var95_num = (int(round(0.05 * Total)))
His_Var99_num = (int(round(0.01 * Total)))
print(His_Var95_num, His_Var99_num)
Var95_value = investment * sort_return[His_Var95_num]
Var99_value = investment * sort_return[His_Var99_num]
print(Var95_value, Var99_value)