├── Fantasy_Cricket_Game
├── Fantasy_Cricket_Game-master
│ ├── LICENSE
│ ├── README.md
│ ├── __pycache__
│ │ └── evaluateTeam.cpython-37.pyc
│ ├── evaluateTeam.py
│ ├── evaluateTeam.ui
│ ├── fantasy.db
│ ├── main.py
│ └── main.ui
└── Readme
├── Final Project
└── Python_FinalProject_ProblemStatement.docx.pdf
├── M5 solution
├── Python_M5Assignment.zip
├── bookstore.db
├── calculate_price.py
└── insert_data.py
├── M6 solution
├── Python_M6Assignment.pdf
├── bookstore.db
├── gui.py
└── gui.ui
├── Python_M2Assignment
├── Python_M2Assignment.pdf
└── Python_M2Assignment_Solution.docx
├── Python_M3Assignment
├── M3 Assignment Solution
│ ├── Main Code - M3 Assignment Solution.py
│ ├── __pycache__
│ │ └── score_calculator.cpython-36.pyc
│ └── score_calculator.py
└── Python_M3Assignment.pdf
├── Python_M4Assignment
├── Python_M4Assignment.pdf
└── assignment4 solution
│ └── Assigh4.py
├── Quiz
├── Final test
├── module 1
├── module 2
├── module 3
├── module 4
├── module 5
└── module 6
└── README.md
/Fantasy_Cricket_Game/Fantasy_Cricket_Game-master/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Aditya Prasad Tripathy
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Fantasy_Cricket_Game/Fantasy_Cricket_Game-master/README.md:
--------------------------------------------------------------------------------
1 | # Fantasy_Cricket_Game
2 | Fantasy Cricket Game is the final project given in the Programming with Python course of Internshala.
3 |
--------------------------------------------------------------------------------
/Fantasy_Cricket_Game/Fantasy_Cricket_Game-master/__pycache__/evaluateTeam.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamsri/Programming-With-Python-Internshala/512fb8ce27fbb73b2f153997a148d02df2f0f73c/Fantasy_Cricket_Game/Fantasy_Cricket_Game-master/__pycache__/evaluateTeam.cpython-37.pyc
--------------------------------------------------------------------------------
/Fantasy_Cricket_Game/Fantasy_Cricket_Game-master/evaluateTeam.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Form implementation generated from reading ui file 'evaluateTeam.ui'
4 | #
5 | # Created by: PyQt5 UI code generator 5.9
6 | #
7 | # WARNING! All changes made in this file will be lost!
8 |
9 | from PyQt5 import QtCore, QtGui, QtWidgets
10 |
11 | class Mini_Ui(object):
12 | def setupUi(self, Dialog):
13 | Dialog.setObjectName("Fantasy Cricket Game")
14 | Dialog.resize(500, 400)
15 | self.verticalLayout = QtWidgets.QVBoxLayout(Dialog)
16 | self.verticalLayout.setContentsMargins(25, -1, 25, -1)
17 | self.verticalLayout.setObjectName("verticalLayout")
18 | self.horizontalLayout = QtWidgets.QHBoxLayout()
19 | self.horizontalLayout.setObjectName("horizontalLayout")
20 | self.label_2 = QtWidgets.QLabel(Dialog)
21 | font = QtGui.QFont()
22 | font.setFamily("Tahoma")
23 | font.setPointSize(10)
24 | self.label_2.setFont(font)
25 | self.label_2.setObjectName("label_2")
26 | self.horizontalLayout.addWidget(self.label_2)
27 | self.cb0 = QtWidgets.QComboBox(Dialog)
28 | font = QtGui.QFont()
29 | font.setFamily("Tahoma")
30 | font.setPointSize(10)
31 | self.cb0.setFont(font)
32 | self.cb0.setObjectName("cb0")
33 | import sqlite3
34 | conn = sqlite3.connect('fantasy.db')
35 | self.horizontalLayout.addWidget(self.cb0)
36 | sql="select name from teams"
37 | cur=conn.execute(sql)
38 | teams=[]
39 | for row in cur:
40 | self.cb0.addItem(row[0])
41 | conn.close()
42 | self.label = QtWidgets.QLabel(Dialog)
43 | font = QtGui.QFont()
44 | font.setFamily("Tahoma")
45 | font.setPointSize(10)
46 | self.label.setFont(font)
47 | self.label.setObjectName("label")
48 | self.horizontalLayout.addWidget(self.label)
49 | self.cb1 = QtWidgets.QComboBox(Dialog)
50 | font = QtGui.QFont()
51 | font.setFamily("Tahoma")
52 | font.setPointSize(10)
53 | self.cb1.setFont(font)
54 | self.cb1.setObjectName("cb1")
55 | self.cb1.addItem("")
56 | self.cb1.addItem("")
57 | self.cb1.addItem("")
58 | self.cb1.addItem("")
59 | self.cb1.addItem("")
60 | self.horizontalLayout.addWidget(self.cb1)
61 | self.verticalLayout.addLayout(self.horizontalLayout)
62 | self.line = QtWidgets.QFrame(Dialog)
63 | font = QtGui.QFont()
64 | font.setFamily("Tahoma")
65 | font.setPointSize(10)
66 | self.line.setFont(font)
67 | self.line.setFrameShape(QtWidgets.QFrame.HLine)
68 | self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
69 | self.line.setObjectName("line")
70 | self.verticalLayout.addWidget(self.line)
71 | self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
72 | self.horizontalLayout_4.setObjectName("horizontalLayout_4")
73 | self.label_5 = QtWidgets.QLabel(Dialog)
74 | font = QtGui.QFont()
75 | font.setFamily("Tahoma")
76 | font.setPointSize(10)
77 | font.setBold(True)
78 | font.setWeight(75)
79 | self.label_5.setFont(font)
80 | self.label_5.setAlignment(QtCore.Qt.AlignCenter)
81 | self.label_5.setObjectName("label_5")
82 | self.horizontalLayout_4.addWidget(self.label_5)
83 | self.label_4 = QtWidgets.QLabel(Dialog)
84 | font = QtGui.QFont()
85 | font.setFamily("Tahoma")
86 | font.setPointSize(10)
87 | font.setBold(True)
88 | font.setWeight(75)
89 | self.label_4.setFont(font)
90 | self.label_4.setAlignment(QtCore.Qt.AlignCenter)
91 | self.label_4.setObjectName("label_4")
92 | self.horizontalLayout_4.addWidget(self.label_4)
93 | self.verticalLayout.addLayout(self.horizontalLayout_4)
94 | self.line_2 = QtWidgets.QFrame(Dialog)
95 | font = QtGui.QFont()
96 | font.setFamily("Tahoma")
97 | font.setPointSize(10)
98 | self.line_2.setFont(font)
99 | self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
100 | self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
101 | self.line_2.setObjectName("line_2")
102 | self.verticalLayout.addWidget(self.line_2)
103 | self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
104 | self.horizontalLayout_2.setObjectName("horizontalLayout_2")
105 | self.lw1 = QtWidgets.QListWidget(Dialog)
106 | font = QtGui.QFont()
107 | font.setFamily("Tahoma")
108 | font.setPointSize(10)
109 | font.setBold(True)
110 | font.setWeight(75)
111 | self.lw1.setFont(font)
112 | self.lw1.setObjectName("lw1")
113 | self.horizontalLayout_2.addWidget(self.lw1)
114 | spacerItem = QtWidgets.QSpacerItem(200, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
115 | self.horizontalLayout_2.addItem(spacerItem)
116 | self.lw2 = QtWidgets.QListWidget(Dialog)
117 | font = QtGui.QFont()
118 | font.setFamily("Tahoma")
119 | font.setPointSize(10)
120 | font.setBold(True)
121 | font.setWeight(75)
122 | self.lw2.setFont(font)
123 | self.lw2.setObjectName("lw2")
124 | self.horizontalLayout_2.addWidget(self.lw2)
125 | self.verticalLayout.addLayout(self.horizontalLayout_2)
126 | self.line_3 = QtWidgets.QFrame(Dialog)
127 | font = QtGui.QFont()
128 | font.setFamily("Tahoma")
129 | font.setPointSize(10)
130 | self.line_3.setFont(font)
131 | self.line_3.setFrameShape(QtWidgets.QFrame.HLine)
132 | self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
133 | self.line_3.setObjectName("line_3")
134 | self.verticalLayout.addWidget(self.line_3)
135 | self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
136 | self.horizontalLayout_3.setObjectName("horizontalLayout_3")
137 | self.pushButton = QtWidgets.QPushButton(Dialog)
138 | font = QtGui.QFont()
139 | font.setFamily("Tahoma")
140 | font.setPointSize(10)
141 | self.pushButton.setFont(font)
142 | self.pushButton.setObjectName("pushButton")
143 | self.pushButton.clicked.connect(self.evaluate)
144 | self.horizontalLayout_3.addWidget(self.pushButton)
145 | spacerItem1 = QtWidgets.QSpacerItem(150, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
146 | self.horizontalLayout_3.addItem(spacerItem1)
147 | self.scorelabel = QtWidgets.QLabel(Dialog)
148 | font = QtGui.QFont()
149 | font.setFamily("Tahoma")
150 | font.setPointSize(10)
151 | font.setBold(True)
152 | font.setWeight(75)
153 | self.scorelabel.setFont(font)
154 | self.scorelabel.setObjectName("scorelabel")
155 | self.horizontalLayout_3.addWidget(self.scorelabel)
156 | self.verticalLayout.addLayout(self.horizontalLayout_3)
157 | self.retranslateUi(Dialog)
158 | QtCore.QMetaObject.connectSlotsByName(Dialog)
159 |
160 | def evaluate(self):
161 | import sqlite3
162 | conn = sqlite3.connect('fantasy.db')
163 | team=self.cb0.currentText()
164 | self.lw1.clear()
165 | sql1="select players, value from teams where name='"+team+"'"
166 | cur=conn.execute(sql1)
167 | row=cur.fetchone()
168 | selected=row[0].split(',')
169 | self.lw1.addItems(selected)
170 | teamttl=0
171 | self.lw2.clear()
172 | match=self.cb1.currentText()
173 | for i in range(self.lw1.count()):
174 | ttl, batscore, bowlscore, fieldscore=0,0,0,0
175 | nm=self.lw1.item(i).text()
176 | cursor=conn.execute("select * from "+match+" where player='"+nm+"'")
177 | row=cursor.fetchone()
178 | batscore=int(row[1]/2)
179 | if batscore>=50: batscore+=5
180 | if batscore>=100: batscore+=10
181 | if row[1]>0:
182 | sr=row[1]/row[2]
183 | if sr>=80 and sr<100: batscore+=2
184 | if sr>=100:batscore+=4
185 | batscore=batscore+row[3]
186 | batscore=batscore+2*row[4]
187 | bowlscore=row[8]*10
188 | if row[8]>=3: bowlscore=bowlscore+5
189 | if row[8]>=5: bowlscore=bowlscore=bowlscore+10
190 | if row[7]>0:
191 | er=6*row[7]/row[5]
192 | if er<=2: bowlscore=bowlscore+10
193 | if er>2 and er<=3.5: bowlscore=bowlscore+7
194 | if er>3.5 and er<=4.5: bowlscore=bowlscore+4
195 | fieldscore=(row[9]+row[10]+row[11])*10
196 | ttl=batscore+bowlscore+fieldscore
197 | self.lw2.addItem(str(ttl))
198 | teamttl=teamttl+ttl
199 | self.scorelabel.setText(str(teamttl))
200 |
201 | def retranslateUi(self, Dialog):
202 | _translate = QtCore.QCoreApplication.translate
203 | Dialog.setWindowTitle(_translate("Dialog", "Fantasy Cricket Game"))
204 | self.label_2.setText(_translate("Dialog", "Choose Team"))
205 | self.label.setText(_translate("Dialog", "Choose Match"))
206 | self.cb1.setItemText(0, _translate("Dialog", "Match1"))
207 | self.label_5.setText(_translate("Dialog", "Players"))
208 | self.label_4.setText(_translate("Dialog", "Score"))
209 | self.pushButton.setText(_translate("Dialog", "Evaluate Score"))
210 | self.scorelabel.setText(_translate("Dialog", "---"))
211 |
212 |
213 | if __name__ == "__main__":
214 | import sys
215 | app = QtWidgets.QApplication(sys.argv)
216 | Dialog = QtWidgets.QDialog()
217 | ui = Mini_Ui()
218 | ui.setupUi(Dialog)
219 | Dialog.show()
220 | sys.exit(app.exec_())
--------------------------------------------------------------------------------
/Fantasy_Cricket_Game/Fantasy_Cricket_Game-master/evaluateTeam.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | Dialog
4 |
5 |
6 |
7 | 0
8 | 0
9 | 500
10 | 400
11 |
12 |
13 |
14 | Dialog
15 |
16 |
17 |
18 | 25
19 |
20 |
21 | 25
22 |
23 | -
24 |
25 |
-
26 |
27 |
28 |
29 | Tahoma
30 | 10
31 |
32 |
33 |
34 | Choose Team
35 |
36 |
37 |
38 | -
39 |
40 |
41 |
42 | Tahoma
43 | 10
44 |
45 |
46 |
47 |
48 | -
49 |
50 |
51 |
52 | Tahoma
53 | 10
54 |
55 |
56 |
57 | Choose Match
58 |
59 |
60 |
61 | -
62 |
63 |
64 |
65 | Tahoma
66 | 10
67 |
68 |
69 |
-
70 |
71 | Match1
72 |
73 |
74 |
75 |
76 |
77 |
78 | -
79 |
80 |
81 |
82 | Tahoma
83 | 10
84 |
85 |
86 |
87 | Qt::Horizontal
88 |
89 |
90 |
91 | -
92 |
93 |
-
94 |
95 |
96 |
97 | Tahoma
98 | 10
99 | 75
100 | true
101 |
102 |
103 |
104 | Players
105 |
106 |
107 | Qt::AlignCenter
108 |
109 |
110 |
111 | -
112 |
113 |
114 |
115 | Tahoma
116 | 10
117 | 75
118 | true
119 |
120 |
121 |
122 | Score
123 |
124 |
125 | Qt::AlignCenter
126 |
127 |
128 |
129 |
130 |
131 | -
132 |
133 |
134 |
135 | Tahoma
136 | 10
137 |
138 |
139 |
140 | Qt::Horizontal
141 |
142 |
143 |
144 | -
145 |
146 |
-
147 |
148 |
149 |
150 | Tahoma
151 | 10
152 | 75
153 | true
154 |
155 |
156 |
157 |
158 | -
159 |
160 |
161 |
162 | Tahoma
163 | 10
164 |
165 |
166 |
167 | Qt::Horizontal
168 |
169 |
170 |
171 | 200
172 | 20
173 |
174 |
175 |
176 |
177 | -
178 |
179 |
180 |
181 | Tahoma
182 | 10
183 | 75
184 | true
185 |
186 |
187 |
188 |
189 |
190 |
191 | -
192 |
193 |
194 |
195 | Tahoma
196 | 10
197 |
198 |
199 |
200 | Qt::Horizontal
201 |
202 |
203 |
204 | -
205 |
206 |
-
207 |
208 |
209 |
210 | Tahoma
211 | 10
212 |
213 |
214 |
215 | Evaluate Score
216 |
217 |
218 |
219 | -
220 |
221 |
222 |
223 | Tahoma
224 | 10
225 |
226 |
227 |
228 | Qt::Horizontal
229 |
230 |
231 | QSizePolicy::Fixed
232 |
233 |
234 |
235 | 150
236 | 20
237 |
238 |
239 |
240 |
241 | -
242 |
243 |
244 |
245 | Tahoma
246 | 10
247 | 75
248 | true
249 |
250 |
251 |
252 | 00
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
--------------------------------------------------------------------------------
/Fantasy_Cricket_Game/Fantasy_Cricket_Game-master/fantasy.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamsri/Programming-With-Python-Internshala/512fb8ce27fbb73b2f153997a148d02df2f0f73c/Fantasy_Cricket_Game/Fantasy_Cricket_Game-master/fantasy.db
--------------------------------------------------------------------------------
/Fantasy_Cricket_Game/Fantasy_Cricket_Game-master/main.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Form implementation generated from reading ui file 'main.ui'
4 | #
5 | # Created by: PyQt5 UI code generator 5.9
6 | #
7 | # WARNING! All changes made in this file will be lost!
8 |
9 | from PyQt5 import QtCore, QtGui, QtWidgets
10 |
11 | class Ui_MainWindow(object):
12 | def setupUi(self, MainWindow):
13 | MainWindow.setObjectName("MainWindow")
14 | MainWindow.resize(900, 675)
15 | MainWindow.move(100,10)
16 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
17 | sizePolicy.setHorizontalStretch(0)
18 | sizePolicy.setVerticalStretch(0)
19 | sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
20 | MainWindow.setSizePolicy(sizePolicy)
21 | MainWindow.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
22 | MainWindow.setAutoFillBackground(False)
23 | self.centralwidget = QtWidgets.QWidget(MainWindow)
24 | self.centralwidget.setObjectName("centralwidget")
25 | self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
26 | self.verticalLayout.setObjectName("verticalLayout")
27 | self.horizontalLayout = QtWidgets.QHBoxLayout()
28 | self.horizontalLayout.setObjectName("horizontalLayout")
29 | self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
30 | self.horizontalLayout_5.setObjectName("horizontalLayout_5")
31 | spacerItem = QtWidgets.QSpacerItem(250, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
32 | self.horizontalLayout_5.addItem(spacerItem)
33 | self.label_4 = QtWidgets.QLabel(self.centralwidget)
34 | self.label_4.setEnabled(False)
35 | font = QtGui.QFont()
36 | font.setPointSize(12)
37 | font.setBold(True)
38 | font.setWeight(75)
39 | self.label_4.setFont(font)
40 | self.label_4.setObjectName("label_4")
41 | self.horizontalLayout_5.addWidget(self.label_4)
42 | self.e1 = QtWidgets.QLineEdit(self.centralwidget)
43 | self.e1.setEnabled(False)
44 | self.e1.setObjectName("e1")
45 | self.horizontalLayout_5.addWidget(self.e1)
46 | self.label_6 = QtWidgets.QLabel(self.centralwidget)
47 | self.label_6.setEnabled(False)
48 | font = QtGui.QFont()
49 | font.setPointSize(12)
50 | font.setBold(True)
51 | font.setWeight(75)
52 | self.label_6.setFont(font)
53 | self.label_6.setObjectName("label_6")
54 | self.horizontalLayout_5.addWidget(self.label_6)
55 | self.e2 = QtWidgets.QLineEdit(self.centralwidget)
56 | self.e2.setEnabled(False)
57 | self.e2.setObjectName("e2")
58 | self.horizontalLayout_5.addWidget(self.e2)
59 | self.label_7 = QtWidgets.QLabel(self.centralwidget)
60 | self.label_7.setEnabled(False)
61 | font = QtGui.QFont()
62 | font.setPointSize(12)
63 | font.setBold(True)
64 | font.setWeight(75)
65 | self.label_7.setFont(font)
66 | self.label_7.setObjectName("label_7")
67 | self.horizontalLayout_5.addWidget(self.label_7)
68 | self.e3 = QtWidgets.QLineEdit(self.centralwidget)
69 | self.e3.setEnabled(False)
70 | self.e3.setObjectName("e3")
71 | self.horizontalLayout_5.addWidget(self.e3)
72 | self.label_8 = QtWidgets.QLabel(self.centralwidget)
73 | self.label_8.setEnabled(False)
74 | font = QtGui.QFont()
75 | font.setPointSize(12)
76 | font.setBold(True)
77 | font.setWeight(75)
78 | self.label_8.setFont(font)
79 | self.label_8.setObjectName("label_8")
80 | self.horizontalLayout_5.addWidget(self.label_8)
81 | self.e4 = QtWidgets.QLineEdit(self.centralwidget)
82 | self.e4.setEnabled(False)
83 | self.e4.setObjectName("e4")
84 | self.horizontalLayout_5.addWidget(self.e4)
85 | spacerItem1 = QtWidgets.QSpacerItem(250, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
86 | self.horizontalLayout_5.addItem(spacerItem1)
87 | self.horizontalLayout.addLayout(self.horizontalLayout_5)
88 | self.verticalLayout.addLayout(self.horizontalLayout)
89 | self.line = QtWidgets.QFrame(self.centralwidget)
90 | self.line.setFrameShape(QtWidgets.QFrame.HLine)
91 | self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
92 | self.line.setObjectName("line")
93 | self.verticalLayout.addWidget(self.line)
94 | self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
95 | self.horizontalLayout_3.setObjectName("horizontalLayout_3")
96 | spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
97 | self.horizontalLayout_3.addItem(spacerItem2)
98 | self.verticalLayout_8 = QtWidgets.QVBoxLayout()
99 | self.verticalLayout_8.setObjectName("verticalLayout_8")
100 | self.label = QtWidgets.QLabel(self.centralwidget)
101 | font = QtGui.QFont()
102 | font.setPointSize(12)
103 | font.setBold(True)
104 | font.setWeight(75)
105 | self.label.setFont(font)
106 | self.label.setObjectName("label")
107 | self.verticalLayout_8.addWidget(self.label, 0, QtCore.Qt.AlignHCenter)
108 | self.groupBox = QtWidgets.QGroupBox(self.centralwidget)
109 | self.groupBox.setTitle("")
110 | self.groupBox.setFlat(False)
111 | self.groupBox.setCheckable(False)
112 | self.groupBox.setObjectName("groupBox")
113 | self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.groupBox)
114 | self.horizontalLayout_4.setObjectName("horizontalLayout_4")
115 | self.rb1 = QtWidgets.QRadioButton(self.groupBox)
116 | self.rb1.setObjectName("rb1")
117 | self.horizontalLayout_4.addWidget(self.rb1)
118 | self.rb2 = QtWidgets.QRadioButton(self.groupBox)
119 | self.rb2.setObjectName("rb2")
120 | self.horizontalLayout_4.addWidget(self.rb2)
121 | self.rb3 = QtWidgets.QRadioButton(self.groupBox)
122 | self.rb3.setObjectName("rb3")
123 | self.horizontalLayout_4.addWidget(self.rb3)
124 | self.rb4 = QtWidgets.QRadioButton(self.groupBox)
125 | self.rb4.setObjectName("rb4")
126 | self.horizontalLayout_4.addWidget(self.rb4)
127 | self.rb1.toggled.connect(self.ctg)
128 | self.rb2.toggled.connect(self.ctg)
129 | self.rb3.toggled.connect(self.ctg)
130 | self.rb4.toggled.connect(self.ctg)
131 | self.verticalLayout_8.addWidget(self.groupBox)
132 | self.list1 = QtWidgets.QListWidget(self.centralwidget)
133 | self.list1.setAutoFillBackground(True)
134 | self.list1.setStyleSheet("color: rgb(0, 0, 127);\n"
135 | "font: 75 12pt \"MS Shell Dlg 2\";")
136 | self.list1.setAutoScroll(True)
137 | self.list1.setObjectName("list1")
138 | self.list1.itemDoubleClicked.connect(self.removelist1)
139 | self.verticalLayout_8.addWidget(self.list1)
140 | self.btn1 = QtWidgets.QPushButton(self.centralwidget)
141 | font = QtGui.QFont()
142 | font.setPointSize(12)
143 | font.setBold(True)
144 | font.setWeight(75)
145 | self.btn1.setFont(font)
146 | self.btn1.setObjectName("btn1")
147 | self.verticalLayout_8.addWidget(self.btn1)
148 | self.label_5 = QtWidgets.QLabel(self.centralwidget)
149 | self.label_5.setText("")
150 | self.label_5.setAlignment(QtCore.Qt.AlignCenter)
151 | self.label_5.setObjectName("label_5")
152 | self.verticalLayout_8.addWidget(self.label_5)
153 | self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
154 | self.horizontalLayout_2.setObjectName("horizontalLayout_2")
155 | self.verticalLayout_2 = QtWidgets.QVBoxLayout()
156 | self.verticalLayout_2.setObjectName("verticalLayout_2")
157 | self.horizontalLayout_2.addLayout(self.verticalLayout_2)
158 | self.verticalLayout_8.addLayout(self.horizontalLayout_2)
159 | self.horizontalLayout_3.addLayout(self.verticalLayout_8)
160 | spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
161 | self.horizontalLayout_3.addItem(spacerItem3)
162 | self.verticalLayout_9 = QtWidgets.QVBoxLayout()
163 | self.verticalLayout_9.setObjectName("verticalLayout_9")
164 | self.label_2 = QtWidgets.QLabel(self.centralwidget)
165 | font = QtGui.QFont()
166 | font.setPointSize(12)
167 | font.setBold(True)
168 | font.setWeight(75)
169 | self.label_2.setFont(font)
170 | self.label_2.setAlignment(QtCore.Qt.AlignCenter)
171 | self.label_2.setObjectName("label_2")
172 | self.verticalLayout_9.addWidget(self.label_2)
173 | self.l1 = QtWidgets.QLabel(self.centralwidget)
174 | self.l1.setEnabled(True)
175 | font = QtGui.QFont()
176 | font.setFamily("MS Shell Dlg 2")
177 | font.setPointSize(12)
178 | font.setBold(False)
179 | font.setItalic(False)
180 | font.setWeight(9)
181 | self.l1.setFont(font)
182 | self.l1.setAlignment(QtCore.Qt.AlignCenter)
183 | self.l1.setObjectName("l1")
184 | self.verticalLayout_9.addWidget(self.l1)
185 | self.line_2 = QtWidgets.QFrame(self.centralwidget)
186 | self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
187 | self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
188 | self.line_2.setObjectName("line_2")
189 | self.verticalLayout_9.addWidget(self.line_2)
190 | spacerItem4 = QtWidgets.QSpacerItem(20, 3, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
191 | self.verticalLayout_9.addItem(spacerItem4)
192 | self.list2 = QtWidgets.QListWidget(self.centralwidget)
193 | self.list2.setStyleSheet("color: rgb(0, 0, 127);\n"
194 | "font: 75 12pt \"MS Shell Dlg 2\";")
195 | self.list2.setObjectName("list2")
196 | self.list2.itemDoubleClicked.connect(self.removelist2)
197 | self.verticalLayout_9.addWidget(self.list2)
198 | self.btn2 = QtWidgets.QPushButton(self.centralwidget)
199 | font = QtGui.QFont()
200 | font.setPointSize(12)
201 | font.setBold(True)
202 | font.setWeight(75)
203 | self.btn2.setFont(font)
204 | self.btn2.setObjectName("btn2")
205 | self.verticalLayout_9.addWidget(self.btn2)
206 | self.label_3 = QtWidgets.QLabel(self.centralwidget)
207 | self.label_3.setText("")
208 | self.label_3.setPixmap(QtGui.QPixmap("dream1.png"))
209 | self.label_3.setObjectName("label_3")
210 | self.verticalLayout_9.addWidget(self.label_3)
211 | self.horizontalLayout_3.addLayout(self.verticalLayout_9)
212 | spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
213 | self.horizontalLayout_3.addItem(spacerItem5)
214 | self.verticalLayout.addLayout(self.horizontalLayout_3)
215 | MainWindow.setCentralWidget(self.centralwidget)
216 | self.menubar = QtWidgets.QMenuBar(MainWindow)
217 | self.menubar.setGeometry(QtCore.QRect(0, 0, 900, 21))
218 | self.menubar.setObjectName("menubar")
219 | self.menuFile = QtWidgets.QMenu(self.menubar)
220 | self.menuFile.setObjectName("menuFile")
221 | MainWindow.setMenuBar(self.menubar)
222 | self.statusbar = QtWidgets.QStatusBar(MainWindow)
223 | self.statusbar.setObjectName("statusbar")
224 | MainWindow.setStatusBar(self.statusbar)
225 | self.actionNew = QtWidgets.QAction(MainWindow)
226 | self.actionNew.setObjectName("actionNew")
227 | self.actionOpen = QtWidgets.QAction(MainWindow)
228 | self.actionOpen.setObjectName("actionOpen")
229 | self.actionSave_Team = QtWidgets.QAction(MainWindow)
230 | self.actionSave_Team.setObjectName("actionSave_Team")
231 | self.actionRules = QtWidgets.QAction(MainWindow)
232 | self.actionRules.setObjectName("actionRules")
233 | self.actionInstructions = QtWidgets.QAction(MainWindow)
234 | self.actionInstructions.setObjectName("actionInstructions")
235 | self.actionQuit = QtWidgets.QAction(MainWindow)
236 | self.actionQuit.setObjectName("actionQuit")
237 | self.menuFile.addAction(self.actionNew)
238 | self.menuFile.addAction(self.actionOpen)
239 | self.menuFile.addAction(self.actionSave_Team)
240 | self.menuFile.addAction(self.actionQuit)
241 | self.menuFile.triggered[QtWidgets.QAction].connect(self.menufunction)
242 | self.menubar.addAction(self.menuFile.menuAction())
243 | self.bat=0
244 | self.bwl=0
245 | self.ar=0
246 | self.wk=0
247 | self.avl=1000
248 | self.used=0
249 | self.retranslateUi(MainWindow)
250 | QtCore.QMetaObject.connectSlotsByName(MainWindow)
251 | MainWindow.customContextMenuRequested.connect(self.context_menu)
252 |
253 | def retranslateUi(self, MainWindow):
254 | _translate = QtCore.QCoreApplication.translate
255 | MainWindow.setWindowTitle(_translate("MainWindow", "Fantasy Cricket Game"))
256 | self.label_4.setText(_translate("MainWindow", "Batsmen"))
257 | self.label_6.setText(_translate("MainWindow", "Bowlers"))
258 | self.label_7.setText(_translate("MainWindow", "All Rounders"))
259 | self.label_8.setText(_translate("MainWindow", "Wicketkeepers"))
260 | self.label.setText(_translate("MainWindow", "Player Categories"))
261 | self.rb1.setText(_translate("MainWindow", "BAT"))
262 | self.rb2.setText(_translate("MainWindow", "BOWL"))
263 | self.rb3.setText(_translate("MainWindow", "AR"))
264 | self.rb4.setText(_translate("MainWindow", "WK"))
265 | self.btn1.setText(_translate("MainWindow", "Available Points : 1000"))
266 | self.label_2.setText(_translate("MainWindow", "Selected Players"))
267 | self.l1.setText(_translate("MainWindow", "Team_name"))
268 | self.btn2.setText(_translate("MainWindow", "Points used : "))
269 | self.menuFile.setTitle(_translate("MainWindow", "File"))
270 | self.actionNew.setText(_translate("MainWindow", "NEW Team"))
271 | self.actionOpen.setText(_translate("MainWindow", "OPEN Team"))
272 | self.actionSave_Team.setText(_translate("MainWindow", "SAVE Team"))
273 | self.actionQuit.setText(_translate("MainWindow", "EVALUATE Team"))
274 |
275 | def menufunction(self, action):
276 | txt=action.text()
277 | if txt=="NEW Team":
278 | self.bat=0
279 | self.bwl=0
280 | self.ar=0
281 | self.wk=0
282 | self.avl=1000
283 | self.used=0
284 | self.list1.clear()
285 | self.list2.clear()
286 | self.l1.setText("Team_name")
287 | self.showstatus()
288 | text, ok = QtWidgets.QInputDialog.getText(MainWindow, 'Fantasy Cricket Game', 'Enter name of team:')
289 | if ok:
290 | self.l1.setText(str(text))
291 | if txt=='SAVE Team':
292 | selected=""
293 | count=self.list2.count()
294 | for i in range(count):
295 | selected=selected+self.list2.item(i).text()
296 | if i=5:msg="Batsmen not more than 5"
388 | if ctgr=="BWL" and self.bwl>=5:msg="bowlers not more than 5"
389 | if ctgr=="AR" and self.ar>=3:msg="Allrounders not more than 3"
390 | if ctgr=="WK" and self.wk>=1:msg="Wicketkeepers not more than 1"
391 | if msg!='' or self.avl<=0:
392 | msg = 'You have exhausted your points'
393 | self.showdlg(msg)
394 | return False
395 | if ctgr=="BAT":self.bat+=1
396 | if ctgr=="BWL":self.bwl+=1
397 | if ctgr=="AR":self.ar+=1
398 | if ctgr=="WK":self.wk+=1
399 | cursor = conn.execute("SELECT player,value from stats where player='"+item.text()+"'")
400 | row=cursor.fetchone()
401 | self.avl=self.avl-int(row[1])
402 | self.used=self.used+int(row[1])
403 | return True
404 |
405 | def showstatus(self):
406 | self.e1.setText(str(self.bat))
407 | self.e2.setText(str(self.bwl))
408 | self.e3.setText(str(self.ar))
409 | self.e4.setText(str(self.wk))
410 | self.btn1.setText("Available Points : {}".format(self.avl))
411 | self.btn2.setText("Points used : {}".format(self.used))
412 |
413 | def removelist1(self, item):
414 | ctgr=''
415 | if self.rb1.isChecked()==True:ctgr='BAT'
416 | if self.rb2.isChecked()==True:ctgr='BWL'
417 | if self.rb3.isChecked()==True:ctgr='AR'
418 | if self.rb4.isChecked()==True:ctgr='WK'
419 | ret=self.criteria(ctgr, item)
420 | if ret==True:
421 | self.list1.takeItem(self.list1.row(item))
422 | self.list2.addItem(item.text())
423 | self.showstatus()
424 |
425 | def showdlg(self, msg):
426 | Dialog = QtWidgets.QMessageBox()
427 | Dialog.setText(msg)
428 | Dialog.setWindowTitle("Fantasy Cricket Game")
429 | ret=Dialog.exec()
430 |
431 | def removelist2(self, item):
432 | self.list2.takeItem(self.list2.row(item))
433 | cursor = conn.execute("SELECT player,value, ctg from stats where player='"+item.text()+"'")
434 | row=cursor.fetchone()
435 | self.avl=self.avl+int(row[1])
436 | self.used=self.used-int(row[1])
437 | ctgr=row[2]
438 | if ctgr=="BAT":
439 | self.bat-=1
440 | if self.rb1.isChecked()==True:self.list1.addItem(item.text())
441 | if ctgr=="BWL":
442 | self.bwl-=1
443 | if self.rb2.isChecked()==True:self.list1.addItem(item.text())
444 | if ctgr=="AR":
445 | self.ar-=1
446 | if self.rb3.isChecked()==True:self.list1.addItem(item.text())
447 | if ctgr=="WK":
448 | self.wk-=1
449 | if self.rb4.isChecked()==True:self.list1.addItem(item.text())
450 | self.showstatus()
451 |
452 | if __name__ == "__main__":
453 | import sqlite3
454 | conn = sqlite3.connect('fantasy.db')
455 | import sys
456 | app = QtWidgets.QApplication(sys.argv)
457 | MainWindow = QtWidgets.QMainWindow()
458 | ui = Ui_MainWindow()
459 | ui.setupUi(MainWindow)
460 | MainWindow.show()
461 | sys.exit(app.exec_())
462 | conn.close()
--------------------------------------------------------------------------------
/Fantasy_Cricket_Game/Fantasy_Cricket_Game-master/main.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 900
10 | 675
11 |
12 |
13 |
14 |
15 | 0
16 | 0
17 |
18 |
19 |
20 | Qt::CustomContextMenu
21 |
22 |
23 | Fantasy Cricket Game
24 |
25 |
26 | false
27 |
28 |
29 |
30 | -
31 |
32 |
-
33 |
34 |
-
35 |
36 |
37 | Qt::Horizontal
38 |
39 |
40 |
41 | 250
42 | 20
43 |
44 |
45 |
46 |
47 | -
48 |
49 |
50 | false
51 |
52 |
53 |
54 | 12
55 | 75
56 | true
57 |
58 |
59 |
60 | Batsmen
61 |
62 |
63 |
64 | -
65 |
66 |
67 | false
68 |
69 |
70 |
71 | -
72 |
73 |
74 | false
75 |
76 |
77 |
78 | 12
79 | 75
80 | true
81 |
82 |
83 |
84 | Bowlers
85 |
86 |
87 |
88 | -
89 |
90 |
91 | false
92 |
93 |
94 |
95 | -
96 |
97 |
98 | false
99 |
100 |
101 |
102 | 12
103 | 75
104 | true
105 |
106 |
107 |
108 | All Rounders
109 |
110 |
111 |
112 | -
113 |
114 |
115 | false
116 |
117 |
118 |
119 | -
120 |
121 |
122 | false
123 |
124 |
125 |
126 | 12
127 | 75
128 | true
129 |
130 |
131 |
132 | Wicketkeepers
133 |
134 |
135 |
136 | -
137 |
138 |
139 | false
140 |
141 |
142 |
143 | -
144 |
145 |
146 | Qt::Horizontal
147 |
148 |
149 |
150 | 250
151 | 20
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 | -
161 |
162 |
163 | Qt::Horizontal
164 |
165 |
166 |
167 | -
168 |
169 |
-
170 |
171 |
172 | Qt::Horizontal
173 |
174 |
175 |
176 | 40
177 | 20
178 |
179 |
180 |
181 |
182 | -
183 |
184 |
-
185 |
186 |
187 |
188 | 12
189 | 75
190 | true
191 |
192 |
193 |
194 | Player Categories
195 |
196 |
197 |
198 | -
199 |
200 |
201 |
202 |
203 |
204 | false
205 |
206 |
207 | false
208 |
209 |
210 |
-
211 |
212 |
213 | BAT
214 |
215 |
216 |
217 | -
218 |
219 |
220 | BOWL
221 |
222 |
223 |
224 | -
225 |
226 |
227 | AR
228 |
229 |
230 |
231 | -
232 |
233 |
234 | WK
235 |
236 |
237 |
238 |
239 |
240 |
241 | -
242 |
243 |
244 | true
245 |
246 |
247 | color: rgb(0, 0, 127);
248 | font: 75 12pt "MS Shell Dlg 2";
249 |
250 |
251 | true
252 |
253 |
254 |
255 | -
256 |
257 |
258 |
259 | 12
260 | 75
261 | true
262 |
263 |
264 |
265 | Available Points : 1000
266 |
267 |
268 |
269 | -
270 |
271 |
272 |
273 |
274 |
275 | Qt::AlignCenter
276 |
277 |
278 |
279 | -
280 |
281 |
-
282 |
283 |
284 |
285 |
286 |
287 |
288 | -
289 |
290 |
291 | Qt::Horizontal
292 |
293 |
294 |
295 | 40
296 | 20
297 |
298 |
299 |
300 |
301 | -
302 |
303 |
-
304 |
305 |
306 |
307 | 12
308 | 75
309 | true
310 |
311 |
312 |
313 | Selected Players
314 |
315 |
316 | Qt::AlignCenter
317 |
318 |
319 |
320 | -
321 |
322 |
323 | true
324 |
325 |
326 |
327 | MS Shell Dlg 2
328 | 12
329 | 9
330 | false
331 | false
332 |
333 |
334 |
335 | Team_name
336 |
337 |
338 | Qt::AlignCenter
339 |
340 |
341 |
342 | -
343 |
344 |
345 | Qt::Horizontal
346 |
347 |
348 |
349 | -
350 |
351 |
352 | Qt::Vertical
353 |
354 |
355 | QSizePolicy::Minimum
356 |
357 |
358 |
359 | 20
360 | 3
361 |
362 |
363 |
364 |
365 | -
366 |
367 |
368 | color: rgb(0, 0, 127);
369 | font: 75 12pt "MS Shell Dlg 2";
370 |
371 |
372 |
373 | -
374 |
375 |
376 |
377 | 12
378 | 75
379 | true
380 |
381 |
382 |
383 | Points used :
384 |
385 |
386 |
387 | -
388 |
389 |
390 |
391 |
392 |
393 | dream1.png
394 |
395 |
396 |
397 |
398 |
399 | -
400 |
401 |
402 | Qt::Horizontal
403 |
404 |
405 |
406 | 40
407 | 20
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
436 |
437 |
438 |
439 | NEW Team
440 |
441 |
442 |
443 |
444 | OPEN Team
445 |
446 |
447 |
448 |
449 | SAVE Team
450 |
451 |
452 |
453 |
454 | Quit
455 |
456 |
457 |
458 |
459 |
460 |
461 |
--------------------------------------------------------------------------------
/Fantasy_Cricket_Game/Readme:
--------------------------------------------------------------------------------
1 | Fantasy Cricket Game is the final project given in the Programming with Python course of Internshala.
2 | Hope You will LIKE THIS..!!!!
3 |
--------------------------------------------------------------------------------
/Final Project/Python_FinalProject_ProblemStatement.docx.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamsri/Programming-With-Python-Internshala/512fb8ce27fbb73b2f153997a148d02df2f0f73c/Final Project/Python_FinalProject_ProblemStatement.docx.pdf
--------------------------------------------------------------------------------
/M5 solution/Python_M5Assignment.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamsri/Programming-With-Python-Internshala/512fb8ce27fbb73b2f153997a148d02df2f0f73c/M5 solution/Python_M5Assignment.zip
--------------------------------------------------------------------------------
/M5 solution/bookstore.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamsri/Programming-With-Python-Internshala/512fb8ce27fbb73b2f153997a148d02df2f0f73c/M5 solution/bookstore.db
--------------------------------------------------------------------------------
/M5 solution/calculate_price.py:
--------------------------------------------------------------------------------
1 | import sqlite3
2 | book=sqlite3.connect("bookstore.db")
3 | curbook=book.cursor()
4 | total_price=0
5 | while True:
6 | bt=input("Book Title: ")
7 | sql="select *from books where book_name='"+bt+"';"
8 | curbook.execute(sql)
9 | record=curbook.fetchone()
10 | print(record)
11 | n=int(input("No. of copies: "))
12 | total_price=total_price+record[3]*n
13 | add_book=input("Add more books? Y/N ")
14 | if add_book=='N':
15 | break
16 | print("Total Cost {}".format(total_price))
17 | n=input("enter to exit")
18 | book.close()
19 |
--------------------------------------------------------------------------------
/M5 solution/insert_data.py:
--------------------------------------------------------------------------------
1 | import sqlite3
2 | book=sqlite3.connect("bookstore.db")
3 | curbook=book.cursor()
4 | #curbook.execute('''create table books (book_id integer primary key autoincrement , book_name text(20), author text(20), price integer);''')
5 |
6 | while True:
7 | x=input("want to enter data yes/no: ")
8 | if x=='yes':
9 | book_id=int(input("Enter book id: "))
10 | book_name=input("Enter book name: ")
11 | author=input("Enter author name: ")
12 | price=input("Enter price of book: ")
13 | curbook.execute("insert into books (book_id,book_name,author, price) values(?,?,?,?);",(book_id,book_name,author, price))
14 | book.commit()
15 | print("data add successfully")
16 |
17 | else:
18 | break
19 |
20 |
21 |
22 |
23 |
24 | #book.close()
25 |
--------------------------------------------------------------------------------
/M6 solution/Python_M6Assignment.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamsri/Programming-With-Python-Internshala/512fb8ce27fbb73b2f153997a148d02df2f0f73c/M6 solution/Python_M6Assignment.pdf
--------------------------------------------------------------------------------
/M6 solution/bookstore.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamsri/Programming-With-Python-Internshala/512fb8ce27fbb73b2f153997a148d02df2f0f73c/M6 solution/bookstore.db
--------------------------------------------------------------------------------
/M6 solution/gui.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Form implementation generated from reading ui file 'gui.ui'
4 | #
5 | # Created by: PyQt5 UI code generator 5.11.2
6 | #
7 | # WARNING! All changes made in this file will be lost!
8 |
9 | from PyQt5 import QtCore, QtGui, QtWidgets
10 | import sqlite3
11 |
12 | class Ui_MainWindow(object):
13 | def setupUi(self, MainWindow):
14 | MainWindow.setObjectName("MainWindow")
15 | MainWindow.resize(600, 350)
16 | MainWindow.setStyleSheet("background-color:rgb(255, 255, 255)")
17 | self.centralwidget = QtWidgets.QWidget(MainWindow)
18 | self.centralwidget.setObjectName("centralwidget")
19 | self.label = QtWidgets.QLabel(self.centralwidget)
20 | self.label.setGeometry(QtCore.QRect(80, 60, 91, 31))
21 | font = QtGui.QFont()
22 | font.setFamily("Arial")
23 | font.setPointSize(10)
24 | font.setBold(False)
25 | font.setWeight(50)
26 | self.label.setFont(font)
27 | self.label.setObjectName("label")
28 | self.label_3 = QtWidgets.QLabel(self.centralwidget)
29 | self.label_3.setGeometry(QtCore.QRect(80, 190, 71, 31))
30 | font = QtGui.QFont()
31 | font.setFamily("Arial")
32 | font.setPointSize(10)
33 | font.setBold(False)
34 | font.setWeight(50)
35 | self.label_3.setFont(font)
36 | self.label_3.setObjectName("label_3")
37 | self.label_2 = QtWidgets.QLabel(self.centralwidget)
38 | self.label_2.setGeometry(QtCore.QRect(120, 100, 51, 31))
39 | font = QtGui.QFont()
40 | font.setFamily("Arial")
41 | font.setPointSize(10)
42 | font.setBold(False)
43 | font.setWeight(50)
44 | self.label_2.setFont(font)
45 | self.label_2.setObjectName("label_2")
46 | self.t1 = QtWidgets.QLineEdit(self.centralwidget)
47 | self.t1.setGeometry(QtCore.QRect(192, 61, 231, 31))
48 | font = QtGui.QFont()
49 | font.setFamily("Arial")
50 | font.setPointSize(10)
51 | font.setBold(True)
52 | font.setWeight(75)
53 | self.t1.setFont(font)
54 | self.t1.setObjectName("t1")
55 | self.t3 = QtWidgets.QLineEdit(self.centralwidget)
56 | self.t3.setGeometry(QtCore.QRect(190, 190, 231, 31))
57 | font = QtGui.QFont()
58 | font.setFamily("Arial")
59 | font.setPointSize(10)
60 | font.setBold(True)
61 | font.setWeight(75)
62 | self.t3.setFont(font)
63 | self.t3.setObjectName("t3")
64 | self.label_4 = QtWidgets.QLabel(self.centralwidget)
65 | self.label_4.setGeometry(QtCore.QRect(120, 230, 51, 31))
66 | font = QtGui.QFont()
67 | font.setFamily("Arial")
68 | font.setPointSize(10)
69 | font.setBold(False)
70 | font.setWeight(50)
71 | self.label_4.setFont(font)
72 | self.label_4.setObjectName("label_4")
73 | self.t2 = QtWidgets.QLineEdit(self.centralwidget)
74 | self.t2.setGeometry(QtCore.QRect(190, 100, 91, 31))
75 | font = QtGui.QFont()
76 | font.setFamily("Arial")
77 | font.setPointSize(10)
78 | font.setBold(True)
79 | font.setWeight(75)
80 | self.t2.setFont(font)
81 | self.t2.setStyleSheet("color:blue;\n"
82 | "border:none")
83 | self.t2.setObjectName("t2")
84 | self.t4 = QtWidgets.QLineEdit(self.centralwidget)
85 | self.t4.setGeometry(QtCore.QRect(190, 230, 91, 31))
86 | font = QtGui.QFont()
87 | font.setFamily("Arial")
88 | font.setPointSize(10)
89 | font.setBold(True)
90 | font.setWeight(75)
91 | self.t4.setFont(font)
92 | self.t4.setStyleSheet("color:blue;\n"
93 | "border:none")
94 | self.t4.setObjectName("t4")
95 | self.line = QtWidgets.QFrame(self.centralwidget)
96 | self.line.setGeometry(QtCore.QRect(140, 140, 411, 20))
97 | self.line.setStyleSheet("")
98 | self.line.setFrameShape(QtWidgets.QFrame.HLine)
99 | self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
100 | self.line.setObjectName("line")
101 | self.btn1 = QtWidgets.QPushButton(self.centralwidget)
102 | self.btn1.setGeometry(QtCore.QRect(450, 60, 91, 31))
103 | font = QtGui.QFont()
104 | font.setFamily("Arial")
105 | font.setPointSize(9)
106 | font.setBold(True)
107 | font.setWeight(75)
108 | self.btn1.setFont(font)
109 | self.btn1.setStyleSheet("border:1px solid black;\n"
110 | "background-color:#D3D3D3")
111 | self.btn1.setObjectName("btn1")
112 | self.btn1.clicked.connect(self.FindPrice)
113 | self.btn2 = QtWidgets.QPushButton(self.centralwidget)
114 | self.btn2.setGeometry(QtCore.QRect(450, 190, 91, 31))
115 | font = QtGui.QFont()
116 | font.setFamily("Arial")
117 | font.setPointSize(9)
118 | font.setBold(True)
119 | font.setWeight(75)
120 | self.btn2.setFont(font)
121 | self.btn2.setStyleSheet("border:1px solid black;\n"
122 | "background-color:#D3D3D3")
123 | self.btn2.setObjectName("btn2")
124 | self.btn2.clicked.connect(self.FindTotal)
125 | MainWindow.setCentralWidget(self.centralwidget)
126 | self.menubar = QtWidgets.QMenuBar(MainWindow)
127 | self.menubar.setGeometry(QtCore.QRect(0, 0, 600, 26))
128 | self.menubar.setObjectName("menubar")
129 | MainWindow.setMenuBar(self.menubar)
130 | self.statusbar = QtWidgets.QStatusBar(MainWindow)
131 | self.statusbar.setObjectName("statusbar")
132 | MainWindow.setStatusBar(self.statusbar)
133 |
134 | self.retranslateUi(MainWindow)
135 | QtCore.QMetaObject.connectSlotsByName(MainWindow)
136 |
137 | def retranslateUi(self, MainWindow):
138 | _translate = QtCore.QCoreApplication.translate
139 | MainWindow.setWindowTitle(_translate("MainWindow", "Window Title"))
140 | self.label.setText(_translate("MainWindow", "Book Title:"))
141 | self.label_3.setText(_translate("MainWindow", "Quantity:"))
142 | self.label_2.setText(_translate("MainWindow", "Price :"))
143 | self.t1.setPlaceholderText(_translate("MainWindow", "text"))
144 | self.t3.setPlaceholderText(_translate("MainWindow", "text"))
145 | self.label_4.setText(_translate("MainWindow", "Total :"))
146 | self.t2.setText(_translate("MainWindow", "Rs. 0"))
147 | self.t2.setPlaceholderText(_translate("MainWindow", "text"))
148 | self.t4.setText(_translate("MainWindow", "Rs. 0"))
149 | self.t4.setPlaceholderText(_translate("MainWindow", "text"))
150 | self.btn1.setText(_translate("MainWindow", "Find Price"))
151 | self.btn2.setText(_translate("MainWindow", "Find Total"))
152 |
153 | def FindPrice(self):
154 | book=sqlite3.connect('bookstore.db')
155 | curbook=book.cursor()
156 | title=self.t1.text()
157 | sql="select * from books where book_name='"+title+"';"
158 | x=curbook.execute(sql)
159 |
160 | if x!=None:
161 | #curbook.execute(sql)
162 | y=curbook.fetchone()
163 |
164 | price=(y[3])
165 | self.t2.setText(str(price))
166 | else:
167 | self.t2.setText("Book not found")
168 |
169 | def FindTotal(self):
170 | book=sqlite3.connect('bookstore.db')
171 | curbook=book.cursor()
172 | qnty=int(self.t3.text())
173 | title=self.t1.text()
174 | sql="select * from books where book_name='"+title+"';"
175 | curbook.execute(sql)
176 | y=curbook.fetchone()
177 |
178 | price=(y[3])
179 | self.t4.setText(str(price*qnty))
180 |
181 |
182 |
183 | if __name__ == "__main__":
184 | import sys
185 | app = QtWidgets.QApplication(sys.argv)
186 | MainWindow = QtWidgets.QMainWindow()
187 | ui = Ui_MainWindow()
188 | ui.setupUi(MainWindow)
189 | MainWindow.show()
190 | sys.exit(app.exec_())
191 |
192 |
--------------------------------------------------------------------------------
/M6 solution/gui.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 600
10 | 350
11 |
12 |
13 |
14 | Window Title
15 |
16 |
17 | background-color:rgb(255, 255, 255)
18 |
19 |
20 |
21 |
22 |
23 | 80
24 | 60
25 | 91
26 | 31
27 |
28 |
29 |
30 |
31 | Arial
32 | 10
33 | 50
34 | false
35 |
36 |
37 |
38 | Book Title:
39 |
40 |
41 |
42 |
43 |
44 | 80
45 | 190
46 | 71
47 | 31
48 |
49 |
50 |
51 |
52 | Arial
53 | 10
54 | 50
55 | false
56 |
57 |
58 |
59 | Quantity:
60 |
61 |
62 |
63 |
64 |
65 | 120
66 | 100
67 | 51
68 | 31
69 |
70 |
71 |
72 |
73 | Arial
74 | 10
75 | 50
76 | false
77 |
78 |
79 |
80 | Price :
81 |
82 |
83 |
84 |
85 |
86 | 192
87 | 61
88 | 231
89 | 31
90 |
91 |
92 |
93 |
94 | Arial
95 | 10
96 | 75
97 | true
98 |
99 |
100 |
101 | text
102 |
103 |
104 |
105 |
106 |
107 | 190
108 | 190
109 | 231
110 | 31
111 |
112 |
113 |
114 |
115 | Arial
116 | 10
117 | 75
118 | true
119 |
120 |
121 |
122 | text
123 |
124 |
125 |
126 |
127 |
128 | 120
129 | 230
130 | 51
131 | 31
132 |
133 |
134 |
135 |
136 | Arial
137 | 10
138 | 50
139 | false
140 |
141 |
142 |
143 | Total :
144 |
145 |
146 |
147 |
148 |
149 | 190
150 | 100
151 | 91
152 | 31
153 |
154 |
155 |
156 |
157 | Arial
158 | 10
159 | 75
160 | true
161 |
162 |
163 |
164 | color:blue;
165 | border:none
166 |
167 |
168 | Rs. 0
169 |
170 |
171 | text
172 |
173 |
174 |
175 |
176 |
177 | 190
178 | 230
179 | 91
180 | 31
181 |
182 |
183 |
184 |
185 | Arial
186 | 10
187 | 75
188 | true
189 |
190 |
191 |
192 | color:blue;
193 | border:none
194 |
195 |
196 | Rs. 0
197 |
198 |
199 | text
200 |
201 |
202 |
203 |
204 |
205 | 140
206 | 140
207 | 411
208 | 20
209 |
210 |
211 |
212 |
213 |
214 |
215 | Qt::Horizontal
216 |
217 |
218 |
219 |
220 |
221 | 450
222 | 60
223 | 91
224 | 31
225 |
226 |
227 |
228 |
229 | Arial
230 | 9
231 | 75
232 | true
233 |
234 |
235 |
236 | border:1px solid black;
237 | background-color:#D3D3D3
238 |
239 |
240 | Find Price
241 |
242 |
243 |
244 |
245 |
246 | 450
247 | 190
248 | 91
249 | 31
250 |
251 |
252 |
253 |
254 | Arial
255 | 9
256 | 75
257 | true
258 |
259 |
260 |
261 | border:1px solid black;
262 | background-color:#D3D3D3
263 |
264 |
265 | Find Total
266 |
267 |
268 |
269 |
279 |
280 |
281 |
282 |
283 |
284 |
--------------------------------------------------------------------------------
/Python_M2Assignment/Python_M2Assignment.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamsri/Programming-With-Python-Internshala/512fb8ce27fbb73b2f153997a148d02df2f0f73c/Python_M2Assignment/Python_M2Assignment.pdf
--------------------------------------------------------------------------------
/Python_M2Assignment/Python_M2Assignment_Solution.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamsri/Programming-With-Python-Internshala/512fb8ce27fbb73b2f153997a148d02df2f0f73c/Python_M2Assignment/Python_M2Assignment_Solution.docx
--------------------------------------------------------------------------------
/Python_M3Assignment/M3 Assignment Solution/Main Code - M3 Assignment Solution.py:
--------------------------------------------------------------------------------
1 | import score_calculator #Importing score_calculator module
2 |
3 | #Giving Inputs as dictionary
4 | p1={'name':'Virat Kohli', 'role':'bat', 'runs':112, '4':10, '6':0, 'balls':119, 'field':0}
5 | p2={'name':'du Plessis', 'role':'bat', 'runs':120, '4':11, '6':2, 'balls':112, 'field':0}
6 | p3={'name':'Bhuvneshwar Kumar', 'role':'bowl', 'wkts':1, 'overs':10, 'runs':71, 'field':1}
7 | p4={'name':'Yuzvendra Chahal', 'role':'bowl', 'wkts':2, 'overs':10, 'runs':45, 'field':0}
8 | p5={'name':'Kuldeep Yadav', 'role':'bowl', 'wkts':3, 'overs':10, 'runs':34, 'field':0}
9 |
10 | players = [p1,p2,p3,p4,p5] # Making a list of dictionaries so that we can iterate through each dictionary
11 |
12 | scores = {}
13 |
14 | for i in players:
15 | if i['role'] == 'bat':
16 | score = score_calculator.batscore(i)
17 | scores[i['name']] = score
18 | print("'name':{},'batscore':{}".format(i['name'],score))
19 | else:
20 | score = score_calculator.bowlscore(i)
21 | scores[i['name']] = score
22 | print("'name':{},'bowlscore':{}".format(i['name'],score))
23 |
24 | max_scorer = max(scores,key=scores.get)
25 |
26 | print("The maximum scorer is {} with score {}".format(max_scorer,max(scores.values())))
27 |
--------------------------------------------------------------------------------
/Python_M3Assignment/M3 Assignment Solution/__pycache__/score_calculator.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamsri/Programming-With-Python-Internshala/512fb8ce27fbb73b2f153997a148d02df2f0f73c/Python_M3Assignment/M3 Assignment Solution/__pycache__/score_calculator.cpython-36.pyc
--------------------------------------------------------------------------------
/Python_M3Assignment/M3 Assignment Solution/score_calculator.py:
--------------------------------------------------------------------------------
1 | # functions used for score calculation
2 |
3 | def batscore(x):
4 | runs = x['runs']
5 | strike_rate = runs/x['balls']
6 | score = runs//2 + (5 if runs >= 50 else 0) + (10 if runs >= 100 else 0) + (2 if strike_rate >= 80/100 and strike_rate <= 1 else 0) + (4 if strike_rate > 1 else 0) + x['4'] + x['6']*2
7 | return score
8 | return {'name':x['name'],'batscore':score}
9 |
10 | def bowlscore(x):
11 | wkts = x['wkts']
12 | economy_rate = x['runs']/x['overs']
13 | fields=x['field']
14 | score = 10*wkts + (10*fields if fields>=1 else 0 ) +(5 if wkts>=3 else 0) + (10 if wkts>=5 else 0) + (4 if economy_rate>=3.5 and economy_rate<=4.5 else 0) + (7 if economy_rate>=2 and economy_rate<3.5 else 0) + (10 if economy_rate<2 else 0)
15 | return score
16 | return {'name':x['name'],'bowlscore':score}
17 |
--------------------------------------------------------------------------------
/Python_M3Assignment/Python_M3Assignment.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamsri/Programming-With-Python-Internshala/512fb8ce27fbb73b2f153997a148d02df2f0f73c/Python_M3Assignment/Python_M3Assignment.pdf
--------------------------------------------------------------------------------
/Python_M4Assignment/Python_M4Assignment.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamsri/Programming-With-Python-Internshala/512fb8ce27fbb73b2f153997a148d02df2f0f73c/Python_M4Assignment/Python_M4Assignment.pdf
--------------------------------------------------------------------------------
/Python_M4Assignment/assignment4 solution/Assigh4.py:
--------------------------------------------------------------------------------
1 | class book:
2 | """ BOOk detaails."""
3 | def __init__(self,a='Concept of physics',b='R.K Bansal',c='S>L Arorah',d=500,q=600 ):
4 | self.title=a
5 | self.author=b
6 | self.publisher=c
7 | self.price=d
8 | self.quan=q
9 | royal=0
10 | def get_title(self):
11 | return self._title
12 | def set_title(self,a):
13 | self.title=a
14 | return
15 | def get_author(self):
16 | return self.author
17 | def set_author(self,b):
18 | self.author=b
19 | return
20 | def get_publisher(self):
21 | return self.publisher()
22 | def set_publisher(self,c):
23 | self.publisher=c
24 | return
25 | def get_price(self):
26 | return self.price
27 | def set_price(self,d):
28 | self.price=d
29 | return
30 | def get_quan(self):
31 | return self.quan
32 | def set_quan(self,e):
33 | self.quan=e
34 | return
35 | def royalty(self):
36 | if self.quan<=500:
37 | royal=.1*self.price*self.quan
38 | elif self.quan>500 and self.quan<=1500:
39 | royal=.125*self.price*(self.quan-500)+.1*self.price*500
40 | elif self.quan>1500:
41 | royal=.1*self.price*500+.125*self.price*1000+.15*self.price*(self.quan-1500)
42 | return royal
43 |
44 | class ebook(book):
45 | """E-BOOK Detais"""
46 | def __init(self,aa='PDF'):
47 | self._fromat=aa
48 | def get_format(self):
49 | return self.format
50 | def set_format(self,b):
51 | self.format=b
52 | return
53 | def royalty(self):
54 | if self.quan<=500:
55 | royal=.1*self.price*self.quan
56 | elif self.quan>500 and self.quan<=1500:
57 | royal=.125*self.price*(self.quan-500)+.1*self.price*500
58 | elif self.quan>1000:
59 | royal=.1*self.price*500+.125*self.price*1000+.15*self.price*(self.quan-1500)
60 | royal=royal-(.12*royal)
61 | return royal
62 | a=input(" Enter the title of the book ")
63 | b=input(" Enter the author ofthe book ")
64 | c=input(" Enter the publisher of book ")
65 | d=int(input(" Enter the price of the book "))
66 | e=int(input(" Enter the total number of books sold "))
67 | f=int(input(" Enter 1 for normal book and enter 2 for e book "))
68 | x=book()
69 | x.set_title(a)
70 | x.set_author(b)
71 | x.set_publisher(c)
72 | x.set_price(d)
73 | x.set_quan(e)
74 | y=ebook()
75 | if f==1:
76 | z=x.royalty()
77 | print(" Title is {} \n Publisher is {} \n Author is {} \n Price was {} \n Total sold {} \n Royalty is {} \n".format(x.title,x.publisher,x.author,x.price,x.quan,z))
78 |
79 | if f==2:
80 | print("b")
81 | g=input("Enter the format of ebook")
82 | z=y.royalty()
83 | y.set_format(g)
84 | print(" Title is {} \n Publisher is {} \n Author is {} \n Price was {} \n Total sold {} \n Format is {} \n Royalty is {} \n".format(y.title,y.publisher,y.author,y.price,y.quan,y.format,z))
85 |
--------------------------------------------------------------------------------
/Quiz/Final test:
--------------------------------------------------------------------------------
1 | Score: 92%
2 |
3 | No. of questions: 30Correct answer: 27Incorrect answer: 3
4 | Show incorrect attempt only
5 |
6 | Question 1 1 Mark
7 | Which of the following is a feature of object oriented programming?
8 |
9 | A
10 | Data encapsulation
11 | B
12 | Inheritance
13 | C
14 | Polymorphism
15 | D
16 | All of the above
17 | Correct Answer: D. All of the above
18 |
19 | Question 2 2 Marks
20 | What is the purpose of the method items() when used with a dictionary?
21 |
22 | A
23 | Returns a list of tuples
24 | B
25 | Returns a tuple of lists
26 | C
27 | Returns a tuple of tuples
28 | D
29 | Returns a list of lists
30 | Correct Answer: A. Returns a list of tuples
31 |
32 | Question 3 3 marks
33 | Given the following assignments, what is the value of the variable, b?
34 |
35 | >>> a=4
36 | >>> b=a
37 | >>> a="Internshala"
38 | >>> b
39 |
40 | A
41 | 4
42 | B
43 | Internshala
44 | C
45 | a
46 | D
47 | You will get an error
48 | Correct Answer: A. 4
49 |
50 | Question 4 1 Mark
51 | Is this statement true or false?
52 |
53 | A list object can contain a tuple as one of the items.
54 |
55 | A
56 | True
57 | B
58 | False
59 | Correct Answer: A. True
60 |
61 | Question 5 2 Marks
62 | In the following list, what is the result of using the function, sort()?
63 |
64 | ['one', 'four', 'three', 'two']
65 |
66 | A
67 | ['four', 'three', 'two', 'one']
68 | B
69 | ['four', 'one', 'three', 'two']
70 | C
71 | ['one', 'two', 'three', 'four']
72 | Correct Answer: B. ['four', 'one', 'three', 'two']
73 |
74 | Question 6 3 marks
75 | What is the output of the following code snippet?
76 |
77 | def func(word, num = 1):
78 | print(word * num)
79 |
80 | func('Pokemon')
81 | func('Go', 3)
82 |
83 | A
84 | Pokemon
85 | Go
86 | B
87 | Pokemon
88 | Go3
89 | C
90 | Pokemon
91 | GoGoGo
92 | D
93 | Error
94 | Correct Answer: C. Pokemon
95 | GoGoGo
96 |
97 | Question 7 1 Mark
98 | Which keyword is used to define a class in Python program?
99 |
100 | A
101 | def
102 | B
103 | init
104 | C
105 | class
106 | D
107 | None of the above
108 | Correct Answer: C. class
109 |
110 | Question 8 2 Marks
111 | Which of the following statements is true about the functions, index() and find()?
112 |
113 | A
114 | Both give the position of the first occurrence of the substring.
115 | B
116 | While index() returns the first occurrence of the substring, find() returns the last occurrence.
117 | C
118 | Both functions return the number of times a substring appears.
119 | Correct Answer: A. Both give the position of the first occurrence of the substring.
120 |
121 | Question 9 3 marks
122 | What is the purpose of the clear() method in a dictionary?
123 |
124 | A
125 | Removes the string items from the dictionary.
126 | B
127 | Removes the dictionary from the memory.
128 | C
129 | Removes all the key-value pairs from the dictionary while retaining the object.
130 | D
131 | Removes all the values from the dictionary while retaining the keys.
132 | Correct Answer: C. Removes all the key-value pairs from the dictionary while retaining the object.
133 |
134 | Question 10 1 Mark
135 | What is the result of the following statements?
136 |
137 | >>> T1=([1,2,3],4,5)
138 | >>>3 in T1
139 |
140 | A
141 | Result will be, 'True'.
142 | B
143 | Result will be, 'False'.
144 | Correct Answer: B. Result will be, 'False'.
145 |
146 | Question 11 2 Marks
147 | Execution of a GUI based application is:
148 |
149 | A
150 | Sequential
151 | B
152 | Object oriented
153 | C
154 | Procedure oriented
155 | D
156 | Event driven
157 | Correct Answer: D. Event driven
158 |
159 | Question 12 3 marks
160 | What is the output of the following code snippet:
161 | import math
162 | math.choice(6,7,8,9)
163 |
164 | A
165 | An integer except 6,7,8 or 9
166 | B
167 | Either 6,7,8 or 9
168 | C
169 | Error
170 | Correct Answer: C. Error
171 |
172 | Question 13 1 Mark
173 | Identify the correct data type.
174 |
175 | 03.00
176 |
177 | A
178 | Integer
179 | B
180 | Complex
181 | C
182 | Float
183 | D
184 | String
185 | Correct Answer: C. Float
186 |
187 | Question 14 2 Marks
188 | Which of the following Python objects is not iterable?
189 |
190 | A
191 | String
192 | B
193 | Dictionary
194 | C
195 | Number
196 | D
197 | Tuple
198 | Correct Answer: C. Number
199 |
200 | Question 15 3 marks
201 | Which of the following is an invalid integer object in Python?
202 |
203 | A
204 | 0o123
205 | B
206 | 123
207 | C
208 | 0123
209 | D
210 | 0x123
211 | Correct Answer: C. 0123
212 |
213 | Question 16 1 Mark
214 | What are the values returned by expressions using comparison operators?
215 |
216 | A
217 | True or False
218 | B
219 | Yes or No
220 | C
221 | 1 or 0
222 | D
223 | Greater than, Less than
224 | Correct Answer: A. True or False
225 |
226 | Question 17 2 Marks
227 | Which of the following statements is used to capture exceptions in Python?
228 |
229 | A
230 | try:
231 | B
232 | if:
233 | C
234 | else:
235 | D
236 | except:
237 | Correct Answer: A. try:
238 |
239 | Question 18 3 marks
240 | Consider the dictionary, years={1995:'Java', 1972:'C', 1994:'Python'}. Will both the following expressions return the same result?
241 |
242 | >>>min(years)
243 | >>>min(years.keys())
244 |
245 | A
246 | Yes, both expressions will return the same result.
247 | B
248 | No, the result from both expressions will be different.
249 | Correct Answer: A. Yes, both expressions will return the same result.
250 |
251 | Question 19 1 Mark
252 | What is wrong with the following list?
253 | buckettuple=[Get a tattoo, Try a new hair colour, share a meal with a stranger, learn salsa, learn pottery]
254 |
255 | A
256 | The items should have been enclosed in round brackets.
257 | B
258 | The identifier of the tuple should not contain the word 'tuple'.
259 | C
260 | The items should be enclosed in quotes.
261 | D
262 | All the letters in the string should be in the same case.
263 | Correct Answer: C. The items should be enclosed in quotes.
264 |
265 | Question 20 2 Marks
266 | What is the purpose of the 'break' statement?
267 |
268 | A
269 | To terminate a loop
270 | B
271 | To restart a loop
272 | C
273 | To create an infinite loop
274 | D
275 | To skip the following statement and restart the loop
276 | Correct Answer: A. To terminate a loop
277 |
278 | Question 21 3 marks
279 | Given the following dictionary object, what is the correct syntax for modifying the value of the key, "Twitter" to 280?
280 |
281 | smedia={"Twitter": 140, "Facebook": "status", "Instagram": "photo", "Snapchat": "message", "Linkedin": "work"}
282 |
283 | A
284 | >>>smedia["Twitter"]=280
285 | B
286 | >>>smedia[140:280]
287 | C
288 | >>>smedia.get("Twitter") >>>"Twitter":280
289 | D
290 | >>>{"Twitter": 280}
291 | Correct Answer: A. >>>smedia["Twitter"]=280
292 |
293 | Question 22 1 Mark
294 | What is the correct method to delete a key-value pair in a dictionary?
295 |
296 | A
297 | del operator
298 | B
299 | pop()
300 | C
301 | Either del operator or pop() can be used
302 | Correct Answer: C. Either del operator or pop() can be used
303 |
304 | Question 23 2 Marks
305 | If L1=[[1,2],[3,4]] is a list, which of the following statements will return the value, True?
306 |
307 | A
308 | 3 in L1
309 | B
310 | [3,4] not in L1
311 | C
312 | [3,4] in L1
313 | Correct Answer: C. [3,4] in L1
314 |
315 | Question 24 3 marks
316 | Which of the following values is an output of the statement:
317 |
318 | random.randint(80,100)
319 |
320 | A
321 | 87.55
322 | B
323 | 80
324 | C
325 | 101
326 | Correct Answer: B. 80
327 |
328 | Question 25 1 Mark
329 | Is this statement true or false?
330 |
331 | The variable name, _books is a valid name.
332 |
333 | A
334 | True
335 | B
336 | False
337 | Correct Answer: A. True
338 |
339 | Question 26 2 Marks
340 | Is the following statement true or false?
341 |
342 | It is mandatory to have return as last statement in function block.
343 |
344 | A
345 | True
346 | B
347 | False
348 | Correct Answer: B. False
349 |
350 | Question 27 3 marks
351 | What is not true about class attribute?
352 |
353 | A
354 | It is defined in __init__() method.
355 | B
356 | Its definition is not present inside any method
357 | C
358 | It is accessible by name of class
359 | D
360 | All options above are true
361 | Correct Answer: A. It is defined in __init__() method.
362 |
363 | Question 28 1 Mark
364 | By default, what is the index from which the range() function generates a sequence of numbers?
365 |
366 | A
367 | 0
368 | B
369 | 1
370 | C
371 | 2
372 | D
373 | None of these.
374 | Correct Answer: A. 0
375 |
376 | Question 29 2 Marks
377 | When the following code was executed, the record for Sherlock was inserted but the record for Watson was not inserted. What is the reason for this?
378 |
379 |
380 | A
381 | Because the changes were already committed using the commit() method.
382 | B
383 | Because the database connection was already closed using the close() method.
384 | C
385 | Because the StudentID for Sherlock is 52, which comes after the studentID for Watson.
386 | Correct Answer: B. Because the database connection was already closed using the close() method.
387 |
388 | Question 30 3 marks
389 | What is output of the following statements?
390 |
391 | >>> L1=[1,2,3,4]
392 | >>> L2=[1,1,1]
393 | >>> print(len(L1+L2))
394 |
395 | A
396 | 7
397 | B
398 | 13
399 | C
400 | 5
401 | D
402 | Error
403 | Correct Answer: A. 7
404 |
--------------------------------------------------------------------------------
/Quiz/module 1:
--------------------------------------------------------------------------------
1 | CHOOSE MODULE
2 |
3 | Introduction to Pyth...
4 | Installation of Python
5 | Using the Python Interpre...
6 | Salient Features of Pytho...
7 | Basic Syntax of Python
8 | Basic Syntax of Python
9 | Keywords Used in Python
10 | Indents
11 | Summary
12 | Module Test
13 | Go to progress report
14 | Logout
15 | Copyright 2019 Internshala
16 | Menu
17 | Module Test
18 | Score: 100%
19 |
20 | No. of questions: 10Correct answer: 10Incorrect answer: 0
21 | Show incorrect attempt only
22 |
23 | Question 1 1 Mark
24 | Is the following statement true or false?
25 |
26 | Dynamic Typing is a feature of Python.
27 |
28 | A
29 | True
30 | B
31 | False
32 | Correct Answer: A. True
33 |
34 | Question 2 2 Marks
35 | What will you see if you type a = 12 * 2 and press Enter in IDLE?
36 |
37 | A
38 | 24
39 | B
40 | 144
41 | C
42 | Nothing
43 | D
44 | Error
45 | Correct Answer: C. Nothing
46 |
47 | Question 3 3 marks
48 | Which of the following statements is False?
49 |
50 | A
51 | Parentheses are mandatory with the print function in Python 3.x but not in Python 2.x.
52 | B
53 | The raw_input() function has been deprecated (discontinued) in Python 3.x.
54 | C
55 | Integer objects are long by default in Python 3.x but not in Python 2.x in which a trailing L is required.
56 | D
57 | In Python 3.x, 5/2 will result in an output of 2.
58 | Correct Answer: D. In Python 3.x, 5/2 will result in an output of 2.
59 |
60 | Question 4 1 Mark
61 | The result of 36%5 is:
62 |
63 | A
64 | 1
65 | B
66 | 7
67 | C
68 | 7.2
69 | D
70 | 1.75
71 | Correct Answer: A. 1
72 |
73 | Question 5 2 Marks
74 | Is the following statement true or false?
75 |
76 | Python is a compiler-based language.
77 |
78 | A
79 | True
80 | B
81 | False
82 | Correct Answer: B. False
83 |
84 | Question 6 3 marks
85 | What is the correct command for displaying all the Python keywords?
86 |
87 | A
88 | >>> import keyword
89 | >>> keyword.kwlist
90 | B
91 | >>> keyword.python
92 | C
93 | >>> import keyword.kwlist
94 | >>> keyword.python
95 | D
96 | >>> import .keyword.kwlist
97 | Correct Answer: A. >>> import keyword
98 | >>> keyword.kwlist
99 |
100 | Question 7 1 Mark
101 | Given the following code in IDLE, what will you see after you type print(a,b,b) and press Enter?
102 |
103 | >>> a=2
104 | >>>b=3
105 | >>>print(a,b,b)
106 |
107 | A
108 | 18
109 | B
110 | a b b
111 | C
112 | 2 3 3
113 | D
114 | Error
115 | Correct Answer: C. 2 3 3
116 |
117 | Question 8 2 Marks
118 | What will you see if you type 19-4*5 and press Enter in IDLE?
119 |
120 | A
121 | 759375
122 | B
123 | -1
124 | C
125 | 75
126 | D
127 | Error
128 | Correct Answer: B. -1
129 |
130 | Question 9 3 marks
131 | There are some syntax errors in the displayed program. Of the options displayed, select the option which is the correct version of this program.
132 |
133 | #The purpose of this
134 | program is to display some text. #
135 |
136 | print ("Hello World")
137 | print ("Welcome to Internshala") #Author Internshala
138 |
139 | A
140 | #The purpose of this
141 | program is to display some text. #
142 |
143 | print (Hello World)
144 | print (Welcome to Internshala) #Author Internshala
145 | B
146 | #The purpose of this
147 | #program is to display some text.
148 |
149 | print ("Hello World")
150 | print ("Welcome to Internshala") #Author Internshala
151 | C
152 | #
153 | The purpose of this
154 | program is to display some text.
155 | #
156 |
157 | print ("Hello World")
158 | print ("Welcome to Internshala") #Author Internshala
159 | Correct Answer: B. #The purpose of this
160 | #program is to display some text.
161 |
162 | print ("Hello World")
163 | print ("Welcome to Internshala") #Author Internshala
164 |
165 | Question 10 1 Mark
166 | Which syntax element is used to define a code block? (A code block is a group of statements that, together, perform a task.)
167 |
168 | A
169 | Comment
170 | B
171 | Triple Quotes, """ """
172 | C
173 | Indent
174 | D
175 | Curly brackets, { }
176 | Correct Answer: C. Indent
177 |
178 | Prev
179 | Text Chapter
180 |
181 | Next
182 | Video
183 |
--------------------------------------------------------------------------------
/Quiz/module 2:
--------------------------------------------------------------------------------
1 | Score: 90%
2 |
3 | No. of questions: 15Correct answer: 14Incorrect answer: 1
4 | Show incorrect attempt only
5 |
6 | Question 1 1 Mark
7 | Which of the following statements best describe a dictionary item in Python?
8 |
9 | A
10 | A dictionary is a sequence of key-value pairs
11 | B
12 | A dictionary is an indexed collection of key-value pairs.
13 | C
14 | A dictionary is an unordered collection of key-value pairs
15 | Correct Answer: C. A dictionary is an unordered collection of key-value pairs
16 |
17 | Question 2 2 Marks
18 | Which function should be used to change 'how are you?' to 'How Are You?' ?
19 |
20 | A
21 | capitalize()
22 | B
23 | title()
24 | C
25 | lower()
26 | D
27 | upper()
28 | Correct Answer: B. title()
29 |
30 | Question 3 3 marks
31 | What is the output of the following statements?
32 |
33 | >>> a=3//2
34 | >>> b=-3//2
35 | >>> a-b
36 |
37 | A
38 | 2
39 | B
40 | 3
41 | C
42 | 0
43 | D
44 | Error
45 | Correct Answer: B. 3
46 |
47 | Question 4 1 Mark
48 | Which of the following objects is not a valid declaration for dictionary?
49 |
50 | A
51 | D1={(1,2):10}
52 | B
53 | D1={[1,2]:10}
54 | C
55 | D1={len([1,2]):10}
56 | Correct Answer: B. D1={[1,2]:10}
57 |
58 | Question 5 2 Marks
59 | Which of the following will result in True?
60 |
61 | A
62 | '0x12'.isdigit()
63 | B
64 | '12.0'.isdigit()
65 | C
66 | '012'.isdigit()
67 | D
68 | '1.2e01'.isdigit()
69 | Correct Answer: C. '012'.isdigit()
70 |
71 | Question 6 3 marks
72 | What is the output of the following statements?
73 |
74 | >>>a=60
75 | >>>b=70
76 | >>>average=(a+b)/2
77 | >>>average
78 |
79 | A
80 | 65
81 | B
82 | 65.0
83 | C
84 | 065
85 | D
86 | 65 +0i
87 | Correct Answer: B. 65.0
88 |
89 | Question 7 1 Mark
90 | Identify the correct data type.
91 |
92 | ["Joey", "Rachael", 2, 6, 5+2j]
93 |
94 | A
95 | List
96 | B
97 | String
98 | C
99 | Dictionary
100 | D
101 | Float
102 | Correct Answer: A. List
103 |
104 | Question 8 2 Marks
105 | After the following statements are executed in Python, what is the resultant value of L1?
106 |
107 | >>> L1=['Python', 'Java', 'C++']
108 | >>> L1.insert(len(L1),'SQL')
109 |
110 | A
111 | ['Python', 'Java', 'C++', 'SQL']
112 | B
113 | ['SQL', 'Python', 'Java', 'C++']
114 | C
115 | ['Python', 'SQL', 'Java', 'C++']
116 | D
117 | ['Python', 'Java', 'SQL', 'C++']
118 | Correct Answer: A. ['Python', 'Java', 'C++', 'SQL']
119 |
120 | Question 9 3 marks
121 | Which of the following results is correct?
122 |
123 | A
124 | >>>15%6
125 | 2
126 | B
127 | >>>15/6
128 | 2
129 | C
130 | >>>15//6
131 | 2
132 | Correct Answer: C. >>>15//6
133 | 2
134 |
135 | Question 10 1 Mark
136 | A variable called Team is assigned the value Sri Lanka . It is possible to re-assign the value 8 to the same variable.
137 |
138 |
139 | A
140 | True
141 | B
142 | False
143 | Correct Answer: A. True
144 |
145 | Question 11 2 Marks
146 | What will be result of following expression?
147 |
148 | 'INTERNSHALA'.lower().isupper()
149 |
150 | A
151 | Result will be, 'True'.
152 | B
153 | Result will be, 'False'.
154 | Correct Answer: B. Result will be, 'False'.
155 |
156 | Question 12 3 marks
157 | Which of the following conversions can be done using the int() function?
158 |
159 | A
160 | Integer to Float
161 | B
162 | Hexadecimal to integer
163 | C
164 | Integer to binary
165 | Correct Answer: B. Hexadecimal to integer
166 |
167 | Question 13 1 Mark
168 | Is this statement true or false?
169 |
170 | The variable name, 3score is a valid name.
171 |
172 | A
173 | True
174 | B
175 | False
176 | Correct Answer: B. False
177 |
178 | Question 14 2 Marks
179 | Which of following statements will result in an error?
180 |
181 | A
182 | tuple('1,2')
183 | B
184 | tuple((1,2))
185 | C
186 | tuple([1,2])
187 | D
188 | tuple(1,2)
189 | Correct Answer: D. tuple(1,2)
190 |
191 | Question 15 3 marks
192 | What is the result of the following expression?
193 |
194 | ‘rain’ in ‘train’
195 |
196 | A
197 | Result is, True
198 | B
199 | Result is, False
200 | Correct Answer: A. Result is, True
201 |
--------------------------------------------------------------------------------
/Quiz/module 3:
--------------------------------------------------------------------------------
1 | Score: 90%
2 |
3 | No. of questions: 15Correct answer: 14Incorrect answer: 1
4 | Show incorrect attempt only
5 |
6 | Question 1 1 Mark
7 | Identify the mode that allows us to process the lines of code one at a time.
8 |
9 | A
10 | Interactive Mode
11 | B
12 | Truncate Mode
13 | C
14 | Scripting Mode
15 | D
16 | Execution Mode
17 | Correct Answer: A. Interactive Mode
18 |
19 | Question 2 2 Marks
20 | What is the output of the following code snippet?
21 |
22 | for x in range(4):
23 | print(x)
24 |
25 | A
26 | 1
27 | 2
28 | 3
29 | 4
30 | B
31 | 0
32 | 1
33 | 2
34 | 3
35 | C
36 | 4
37 | 4
38 | 4
39 | 4
40 | Correct Answer: B. 0
41 | 1
42 | 2
43 | 3
44 |
45 | Question 3 3 marks
46 | Which of the following expressions is the same as math.exp(x)?
47 |
48 | A
49 | x*x
50 | B
51 | x**x
52 | C
53 | math.e**x
54 | D
55 | e**x
56 | Correct Answer: C. math.e**x
57 |
58 | Question 4 1 Mark
59 | Which of the following statements is true about the elif keyword?
60 |
61 | A
62 | It provides a convenient way to check one possibility out of several alternatives.
63 | B
64 | All indented blocks have the same indent level.
65 | C
66 | The else block is executed only if all other expressions are false.
67 | D
68 | All these statements are true.
69 | Correct Answer: D. All these statements are true.
70 |
71 | Question 5 2 Marks
72 | What is the correct sequence of the parameters in the range() function?
73 |
74 | A
75 | Start, Step, Stop
76 | B
77 | Start, Stop, Step
78 | C
79 | Step, Start, Stop
80 | Correct Answer: B. Start, Stop, Step
81 |
82 | Question 6 3 marks
83 | What is the correct term for the arguments, x and y in the following function?
84 |
85 | def test( x, y ):
86 | if x < y:
87 | return x
88 | return y
89 |
90 | print(maxof(12, 19))
91 |
92 | A
93 | Actual parameters
94 | B
95 | Formal parameters
96 | C
97 | Real parameters
98 | Correct Answer: B. Formal parameters
99 |
100 | Question 7 1 Mark
101 | What is the output of the following statements?
102 |
103 | x=10
104 | y=20
105 | x>y
106 |
107 | A
108 | True
109 | B
110 | False
111 | Correct Answer: B. False
112 |
113 | Question 8 2 Marks
114 | Which of following statements is incorrect?
115 |
116 | A
117 | It is necessary to use ‘else’ whenever ‘if’ is used in a program.
118 | B
119 | All statements in a block have the same indent.
120 | C
121 | An indented block is always started after a colon[:] .
122 | D
123 | All statements are true.
124 | Correct Answer: A. It is necessary to use ‘else’ whenever ‘if’ is used in a program.
125 |
126 | Question 9 3 marks
127 | Which of the following function headers is correct?
128 |
129 | A
130 | def test(a=5,b,c):
131 | B
132 | def test(b,c,a=5):
133 | C
134 | def test(c,a=5,b):
135 | D
136 | def test(b=1,c,a=5):
137 | Correct Answer: B. def test(b,c,a=5):
138 |
139 | Question 10 1 Mark
140 | Which of the following is the right statement for including the use of functions in the random library?
141 |
142 | A
143 | import random
144 | B
145 | random.random
146 | C
147 | import.random
148 | D
149 | random()
150 | Correct Answer: A. import random
151 |
152 | Question 11 2 Marks
153 | Which type of operands are permitted with logical operators?
154 |
155 | A
156 | Numeric
157 | B
158 | Boolean
159 | C
160 | String
161 | D
162 | All three - Numeric, Boolean and String
163 | Correct Answer: D. All three - Numeric, Boolean and String
164 |
165 | Question 12 3 marks
166 | Displayed below are two representations of the package, MyFriends. Which of them accurately represents the location of the setup file?
167 |
168 | A
169 | |1MyFriends
170 | | |1MyFriends
171 | | | |1food
172 | | | |1movie
173 | | | | __init__.py
174 | | | | setup.py
175 | B
176 | |1MyFriends
177 | | |1MyFriends
178 | | | |1food
179 | | | |1movie
180 | | | |__init__.py
181 | | | setup.py
182 | Correct Answer: B. |1MyFriends
183 | | |1MyFriends
184 | | | |1food
185 | | | |1movie
186 | | | |__init__.py
187 | | | setup.py
188 |
189 | Question 13 1 Mark
190 | What is the result of the following statement?
191 | 10>20 and 35>25
192 |
193 | A
194 | True
195 | B
196 | False
197 | Correct Answer: B. False
198 |
199 | Question 14 2 Marks
200 | What is the output of the following code snippet?
201 |
202 | for x in range(20,30,3):
203 | print(x)
204 |
205 | A
206 | 21
207 | 24
208 | 27
209 | 30
210 | B
211 | 20,30
212 | 20,30
213 | 20,30
214 | C
215 | 20
216 | 23
217 | 26
218 | 29
219 | Correct Answer: C. 20
220 | 23
221 | 26
222 | 29
223 |
224 | Question 15 3 marks
225 | Which of the following statements will be executed by the Python interpreter without error?
226 |
227 | A
228 | if age>=18
229 | print (“You are eligible to vote”)
230 | else
231 | print (“You are not eligible to vote”)
232 | B
233 | if age>=18:
234 | print (“You are eligible to vote”)
235 | else
236 | print (“You are not eligible to vote”)
237 | C
238 | if age>=18:
239 | print (“You are eligible to vote”)
240 | else:
241 | print (“You are not eligible to vote”)
242 | Correct Answer: C. if age>=18:
243 | print (“You are eligible to vote”)
244 | else:
245 | print (“You are not eligible to vote”)
246 |
--------------------------------------------------------------------------------
/Quiz/module 4:
--------------------------------------------------------------------------------
1 | Score: 57%
2 |
3 | No. of questions: 15Correct answer: 9Incorrect answer: 6
4 | Show incorrect attempt only
5 |
6 | Question 1 1 Mark
7 | Which of the following is not a procedure oriented language?
8 |
9 | A
10 | C
11 | B
12 | FORTRAN
13 | C
14 | Java
15 | D
16 | PASCAL
17 | Correct Answer: C. Java
18 |
19 | Question 2 2 Marks
20 | Choose incorrect option.
21 |
22 | A
23 | Class method is defined with @classmethod decorator
24 | B
25 | Class method is defined inside a class
26 | C
27 | Class method can access only class attributes
28 | D
29 | Class method has one argument called self
30 | Correct Answer: D. Class method has one argument called self
31 |
32 | Question 3 3 marks
33 | Which library function shows list of magic methods inherited from object class?
34 |
35 | A
36 | str()
37 | B
38 | dir()
39 | C
40 | magic()
41 | D
42 | None of the above
43 | Correct Answer: B. dir()
44 |
45 | Question 4 1 Mark
46 | In object oriented programming methodology, object is
47 |
48 | A
49 | Definition of class
50 | B
51 | Instance of class
52 | C
53 | Both a and b
54 | D
55 | None of the above
56 | Correct Answer: B. Instance of class
57 |
58 | Question 5 2 Marks
59 | Instance variables and methods in Python class are:
60 |
61 | A
62 | Public by default
63 | B
64 | Private by default
65 | C
66 | Protected by default
67 | D
68 | These terms are not applicable in python.
69 | Correct Answer: A. Public by default
70 |
71 | Question 6 3 marks
72 | class book:
73 | def __init__(self):
74 | self.name="Python Programming"
75 | self.price=200
76 | b1=book()
77 |
78 | Based on the above, which of the following statements is correct?
79 |
80 | A
81 | print (b1.price)
82 | B
83 | print (book.__price)
84 | C
85 | print(_book.__price)
86 | D
87 | print(b1._book__price)
88 | Correct Answer: A. print (b1.price)
89 |
90 | Question 7 1 Mark
91 | Mechanism of designing a new class based on one or more existing classes is called
92 |
93 | A
94 | Overriding
95 | B
96 | Inheritance
97 | C
98 | Polymorphism
99 | D
100 | None of these
101 | Correct Answer: B. Inheritance
102 |
103 | Question 8 2 Marks
104 | What is not true about overriding?
105 |
106 | A
107 | Overriding can occur in case of inheritance of classes.
108 | B
109 | It is a process of introducing new method in inherited class
110 | C
111 | It is a process of redefining inherited method in child class
112 | D
113 | It is not mandatory to override a base class method in inherited class
114 | Correct Answer: B. It is a process of introducing new method in inherited class
115 |
116 | Question 9 3 marks
117 | In order to overload == operator, which magic method must be overridden?
118 |
119 | A
120 | __comp__()
121 | B
122 | __eq__()
123 | C
124 | __equal__()
125 | D
126 | __ne__()
127 | Correct Answer: B. __eq__()
128 |
129 | Question 10 1 Mark
130 | To overload an operator, corresponding magic method should be
131 |
132 | A
133 | Inherited
134 | B
135 | Overridden
136 | C
137 | Overloaded
138 | Correct Answer: B. Overridden
139 |
140 | Question 11 2 Marks
141 | What is self?
142 |
143 | A
144 | It is a variable.
145 | B
146 | It is a class attribute.
147 | C
148 | It is reference to object which calls an instance method.
149 | D
150 | It is a built-in function in python
151 | Correct Answer: C. It is reference to object which calls an instance method.
152 |
153 | Question 12 3 marks
154 | The __add__() method
155 |
156 | A
157 | Returns addition of two numbers
158 | B
159 | Overloads + operator
160 | C
161 | Should be overridden to overload + operator
162 | D
163 | None of the above
164 | Correct Answer: C. Should be overridden to overload + operator
165 |
166 | Question 13 1 Mark
167 | Which of the following is the correct syntax of inheritance?
168 |
169 | A
170 | class derived(class base):
171 | B
172 | class derived(base):
173 | C
174 | def class derived(base):
175 | D
176 | None of the above
177 | Correct Answer: B. class derived(base):
178 |
179 | Question 14 2 Marks
180 | What is not true about a getter method?
181 |
182 | A
183 | Retrieves value of instance variable
184 | B
185 | Prints value of instance variable
186 | C
187 | Its name starts with ‘get’
188 | D
189 | It is an instance method
190 | Correct Answer: C. Its name starts with ‘get’
191 |
192 | Question 15 3 marks
193 | What is not true about overriding in Python?
194 |
195 | A
196 | Redefining a base class method in inherited class is called method overriding
197 | B
198 | Overriding is essential feature of object oriented language.
199 | C
200 | Overridden method must have same number of arguments as base class method of same name.
201 | D
202 | All the above statements are true.
203 | Correct Answer: C. Overridden method must have same number of arguments as base class method of same name.
204 |
--------------------------------------------------------------------------------
/Quiz/module 5:
--------------------------------------------------------------------------------
1 | Score: 89%
2 |
3 | No. of questions: 10Correct answer: 8Incorrect answer: 2
4 | Show incorrect attempt only
5 |
6 | Question 1 1 Mark
7 | Which of the following statements is true with respect to SQL?
8 |
9 | A
10 | Object oriented language
11 | B
12 | Procedure oriented language
13 | C
14 | Imperative language
15 | D
16 | Declarative language
17 | Correct Answer: D. Declarative language
18 |
19 | Question 2 2 Marks
20 | What is a cursor in the context of database programming?
21 |
22 | A
23 | It is an indicator showing the current position for user interaction.
24 | B
25 | It acts as a handle for a given SQL query using which records are traversed.
26 | C
27 | It stores a list of rows in a table.
28 | Correct Answer: B. It acts as a handle for a given SQL query using which records are traversed.
29 |
30 | Question 3 3 marks
31 | In the following code snippet, what is the connection object?
32 | import sqlite3
33 | MySchool=sqlite3.connect('schooltest.db')
34 |
35 | A
36 | sqlite3
37 | B
38 | MySchool
39 | C
40 | connect()
41 | D
42 | schooltest.db
43 | Correct Answer: B. MySchool
44 |
45 | Question 4 1 Mark
46 | Which of the following is not a RDBMS software?
47 |
48 | A
49 | MS Excel
50 | B
51 | DB2
52 | C
53 | MS Access
54 | D
55 | Oracle
56 | Correct Answer: A. MS Excel
57 |
58 | Question 5 2 Marks
59 | Which of the following statements selects all the columns in the table Internshala?
60 |
61 | A
62 | SELECT ? Internshala
63 | B
64 | SELECT [columns] FROM Internshala
65 | C
66 | SELECT * FROM Internshala
67 | D
68 | SELECT all FROM Internshala
69 | Correct Answer: C. SELECT * FROM Internshala
70 |
71 | Question 6 3 marks
72 | Given the following table, which column is the most ideal primary key?
73 |
74 |
75 | A
76 | Name
77 | B
78 | House
79 | C
80 | Mobile
81 | Correct Answer: C. Mobile
82 |
83 | Question 7 1 Mark
84 | Which of the following statements is not true with respect to relational database?
85 |
86 | A
87 | Relational database integrates data files
88 | B
89 | It ensures data integrity
90 | C
91 | Relational database consists of rows and columns
92 | D
93 | Relational database removes data redundancy
94 | Correct Answer: C. Relational database consists of rows and columns
95 |
96 | Question 8 2 Marks
97 | Which method is used to fetch all the remaining records in the form of a list of tuples?
98 |
99 | A
100 | fetchall()
101 | B
102 | fetchone()
103 | C
104 | select()
105 | D
106 | execute()
107 | Correct Answer: A. fetchall()
108 |
109 | Question 9 3 marks
110 | Given the following tables, what is the ideal foreign key in the Marks table for the Students table?
111 |
112 |
113 | A
114 | Roll-No
115 | B
116 | Name
117 | C
118 | House
119 | Correct Answer: A. Roll-No
120 |
121 | Question 10 1 Mark
122 | Which of the following statements will successfully create a table called Internshala?
123 |
124 | A
125 | CREATE Internshala TABLE COLUMNS(
126 | Name TEXT (20),
127 | Role TEXT,
128 | Crazy INTEGER
129 | );
130 | B
131 | CREATE TABLE Internshala (
132 | Name TEXT (20),
133 | Role TEXT,
134 | Crazy INTEGER
135 | );
136 | Correct Answer: B. CREATE TABLE Internshala (
137 | Name TEXT (20),
138 | Role TEXT,
139 | Crazy INTEGER
140 | );
141 |
--------------------------------------------------------------------------------
/Quiz/module 6:
--------------------------------------------------------------------------------
1 | Score: 84%
2 |
3 | No. of questions: 10Correct answer: 9Incorrect answer: 1
4 | Show incorrect attempt only
5 |
6 | Question 1 1 Mark
7 | In PyQt terminology, what is a signal?
8 |
9 | A
10 | It is an event handler function.
11 | B
12 | It is the event occurring on a widget
13 | C
14 | It is the response emitted by widget when an event occurs
15 | Correct Answer: C. It is the response emitted by widget when an event occurs
16 |
17 | Question 2 2 Marks
18 | What is not true about form layout?
19 |
20 | A
21 | Widgets can be arranged in three columns
22 | B
23 | Each widget has either LabelRole or FieldRole
24 | C
25 | Widgets in first column assume LabelRole
26 | D
27 | Form layout can be nested inside a Box layout
28 | Correct Answer: A. Widgets can be arranged in three columns
29 |
30 | Question 3 3 marks
31 | The correct method to add child layout is:
32 |
33 | A
34 | setLayout()
35 | B
36 | addLayout()
37 | C
38 | addWidget()
39 | Correct Answer: B. addLayout()
40 |
41 | Question 4 1 Mark
42 | What is the purpose of the pyuic utility?
43 |
44 | A
45 | Converts designer file to .ui file
46 | B
47 | Translates the html into Python script
48 | C
49 | Converts a ui file to a py file
50 | Correct Answer: C. Converts a ui file to a py file
51 |
52 | Question 5 2 Marks
53 | Which of the following is the base class for all GUI widgets in PyQt library?
54 |
55 | A
56 | QApplication
57 | B
58 | QObject
59 | C
60 | QMainWindow
61 | D
62 | QWidget
63 | Correct Answer: D. QWidget
64 |
65 | Question 6 3 marks
66 | Which of the following is not a GUI toolkit?
67 |
68 | A
69 | Windows operating system
70 | B
71 | GTK+
72 | C
73 | Qt Framework
74 | D
75 | WxWidgets
76 | Correct Answer: A. Windows operating system
77 |
78 | Question 7 1 Mark
79 | Indicate whether the following statement is True or False.
80 | MSDOS is a GUI based operating system
81 |
82 | A
83 | True
84 | B
85 | False
86 | Correct Answer: B. False
87 |
88 | Question 8 2 Marks
89 | Which of the following statements is not true about a QLabel object?
90 |
91 | A
92 | QLabel cannot be used to display HTML
93 | B
94 | QLabel can respond to events
95 | C
96 | QLabel displays text which cannot be edited
97 | D
98 | QLabel can display an image
99 | Correct Answer: A. QLabel cannot be used to display HTML
100 |
101 | Question 9 3 marks
102 | Which of the following widgets would you use on a form for indicating the gender?
103 | Gender Male | Female
104 |
105 | A
106 | Checkbox
107 | B
108 | Radio button
109 | C
110 | Push button
111 | D
112 | Label
113 | Correct Answer: B. Radio button
114 |
115 | Question 10 1 Mark
116 | What is the purpose of the exec() method of the QApplication class?
117 |
118 | A
119 | Shows the window
120 | B
121 | Starts event loop
122 | C
123 | Executes python script
124 | Correct Answer: B. Starts event loop
125 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Programming-With-Python-Internshala
2 | This is training from internshala of Programming With Python .HERE YOU WILL FIND EVERYTHING RELATED :)
3 |
--------------------------------------------------------------------------------