-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExDatabaseWriteWinner2017.py
More file actions
executable file
·168 lines (138 loc) · 4.69 KB
/
Copy pathExDatabaseWriteWinner2017.py
File metadata and controls
executable file
·168 lines (138 loc) · 4.69 KB
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 24 14:07:17 2018
@author: Dhairyya
"""
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 23 18:24:39 2018
@author: Dhairyya
"""
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 23 16:20:51 2018
@author: Dhairyya
"""
import sqlite3
connection=sqlite3.connect("myTable.db")
crsr=connection.cursor()
playersTeam1=['Lendl Simmons','Parthiv Patel','Ambati Rayudu','Rohit Sharma','Krunal Pandya','Kieron Pollard','Hardik Pandya','Karn Sharma','Mitchell Johnson','Jasprit Bumrah','Lasith Malinga']
playersTeam2=['Ajinkya Rahane','Rahul Tripathi','Steve Smith','MS Dhoni','Manoj Tiwary','Dan Christian','Washington Sundar','Lockie Ferguson','Adam Zampa','Shardul Thakur','Jaydev Unadkat']
sumTotalBatTeam1=0
sumTotalBowlTeam1=0
sumTotalFieldTeam1=0
sumTotalTeam1=0
#batting team1
for player in playersTeam1:
crsr.execute("SELECT * from batValue WHERE name=? and year=2017",(player,))
data=crsr.fetchall()
total=0
count=0
for row in data:
total=total+(row[2]*row[4])
count=count+row[4]
if count==0:
count=1
total=total/count
sumTotalBatTeam1=sumTotalBatTeam1+total
#bowling team1
for player in playersTeam1:
crsr.execute("SELECT * from bowlValue WHERE name=? and year=2017",(player,))
data=crsr.fetchall()
total=0
count=0
for row in data:
total=total+(row[2]*row[4])
count=count+row[4]
if count==0:
count=1
total=total/count
sumTotalBowlTeam1=sumTotalBowlTeam1+total
#fielding team1
for player in playersTeam1:
crsr.execute("SELECT * from fieldValue WHERE name=? and year=2017",(player,))
data=crsr.fetchall()
total=0
count=0
for row in data:
total=total+(row[2]*row[4])
count=count+row[4]
if count==0:
count=1
total=total/count
sumTotalFieldTeam1=sumTotalFieldTeam1+total
sumTotalTeam1 = sumTotalBatTeam1 + sumTotalBowlTeam1 + sumTotalFieldTeam1
#############################################################################
#team2
############################################################################
sumTotalBatTeam2=0
sumTotalBowlTeam2=0
sumTotalFieldTeam2=0
sumTotalTeam2=0
#batting team2
for player in playersTeam2:
crsr.execute("SELECT * from batValue WHERE name=? and year=2017",(player,))
data=crsr.fetchall()
total=0
count=0
for row in data:
total=total+(row[2]*row[4])
count=count+row[4]
if count==0:
count=1
total=total/count
sumTotalBatTeam2=sumTotalBatTeam2+total
#bowling team2
for player in playersTeam2:
crsr.execute("SELECT * from bowlValue WHERE name=? and year=2017",(player,))
data=crsr.fetchall()
total=0
count=0
for row in data:
total=total+(row[2]*row[4])
count=count+row[4]
if count==0:
count=1
total=total/count
sumTotalBowlTeam2=sumTotalBowlTeam2+total
#fielding team2
for player in playersTeam2:
crsr.execute("SELECT * from fieldValue WHERE name=? and year=2017",(player,))
data=crsr.fetchall()
total=0
count=0
for row in data:
total=total+(row[2]*row[4])
count=count+row[4]
if count==0:
count=1
total=total/count
sumTotalFieldTeam2=sumTotalFieldTeam2+total
sumTotalTeam2 = sumTotalBatTeam2 + sumTotalBowlTeam2 + sumTotalFieldTeam2
print "\n"
print "Mumbai Indian Batting Score is "+str(sumTotalBatTeam1)
print "Pune Supergiants Batting Score is "+str(sumTotalBatTeam2)
if sumTotalBatTeam1>sumTotalBatTeam2:
print "Mumbai Indians is superior in batting department\n"
else:
print "Pune Supergiants is superior in batting department\n"
print "Mumbai Indian Bowling Score is "+str(sumTotalBowlTeam1)
print "Pune Supergiants Bowling Score is "+str(sumTotalBowlTeam2)
if sumTotalBowlTeam1>sumTotalBowlTeam2:
print "Mumbai Indians is superior in bowling department\n"
else:
print "Pune Supergiants is superior in bowling department\n"
print "Mumbai Indian Fielding Score is "+str(sumTotalFieldTeam1)
print "Pune Supergiants Fielding Score is "+str(sumTotalFieldTeam2)
if sumTotalFieldTeam1>sumTotalFieldTeam2:
print "Mumbai Indians is superior in fielding department\n"
else:
print "Pune Supergiants is superior in fielding department\n"
print "Mumbai Indian team score is "+ str(sumTotalTeam1)
print "Pune Supergiants team score is "+ str(sumTotalTeam2)
print "Diff is "+ str(sumTotalTeam1-sumTotalTeam2)
if sumTotalTeam1>sumTotalTeam2:
print "Mumbai Indians is superior\n"
else:
print "Pune Supergiants is superior\n"
print "So Mumbai Indians Won IPL 2017"