-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path5.py
34 lines (34 loc) · 847 Bytes
/
5.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
def buka(File):
f = open(File)
l = f.readlines()
data = []
for i in l:
data.append(i.strip('\n').split(' '))
f.close()
return data
def proses(data):
result = []
for i in range(len(data)):
posisi = 0
for j in range(len(data[i])):
k = False
if int(data[i][j]) == 6:
posisi += int(data[i][j])
a = j
k = True
break
while k:
a += 1
posisi += int(data[i][a])
if posisi % 7 == 0:
posisi = 1
if posisi % 17 == 0:
posisi = 100
if posisi == 100:
break
if a == len(data[i])-1:
break
result.append(posisi)
return result
b = buka('soal5.txt')
print(proses(b))