-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
44 lines (32 loc) · 977 Bytes
/
main.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
print("Enter the number of players")
noOfPlayers = int(input())
mals = []
for i in range(noOfPlayers):
print("Enter mal of player-" + str(i+1))
mal = int(input())
mals.append(mal)
print("Who won the game? (Enter position of the player)")
winPos = int(input())
# making negative mals zero
countNoMal = 0
for i in range(len(mals)):
if mals[i] < 0:
countNoMal = countNoMal + 1
mals[i] = 0
# calculating total mal
totalMal = sum(mals)
# print(totalMal)
finalArray = [None] * len(mals);
# calculating mal for no showing players
for i in range(len(mals)):
finalArray[i] = mals[i]
for i in range(len(mals)):
if mals[i] == 0:
finalArray[i] = -(totalMal+10)
# calculating mal for showing players
for i in range(len(mals)):
if mals[i] != 0:
finalArray[i] = (mals[i] * noOfPlayers) - (totalMal + 3)
b = finalArray[winPos-1] - sum(finalArray)
finalArray[winPos-1] = b
print(finalArray)