


















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
It is a training report of a fantacy cricket game.
Typology: Summaries
1 / 26
This page cannot be seen from the preview
Don't miss anything!



















NAME: Shivangi UNIVERSITY UID: 18BCS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
This is a Fantasy cricket Desktop application build in python that allows user to build their own dream cricket team. Fantasy cricket is built in python using Pyqt5 library specifically QtCore, QtGui, QtWidgets for GUI development and Sqlite Studio for Back end database connectivity. In the project the following are the features one can use: Create your own dream team in Auction Save your team and evaluate it later as per Match Initially a Owner will be provided with 1000 Points to purchase there players Team selection follows basic cricketing rules Not more than 5 batsman/bowler Only a Single Wicket Keeper
It is my proud privilege and duty to acknowledge the kind of help and guidance received from several people in preparation of this report. It would not have been possible to prepare this report in this form without their valuable help, cooperation and guidance. First and foremost, I wish to record our sincere gratitude to Internshala Coordinators for their constant support and encouragement in preparation of this report and for making available videos and interface facilities needed to prepare this report. Last but not the least, we wish to thank our parents for financing our studies in this college as well as for constantly encouraging us to learn engineering. Their personal sacrifice in providing this opportunity to learn engineering is gratefully acknowledged.
Topic Page No. Certificate by Course Website/Company/Industry/Institute i Candidate’s Declaration ii Abstract iii Acknowledgement vi About the Course/Company/ Industry / Institute v List of Contents vi CHAPTER 1 INTRODUCTION 1-
1. 1 Introduction to Python 2 1.2 Basics of Programming in Python 3 1.3 Developing a GUI with PyQT 6 1.4 Application of Python in various disciplines 7 CHAPTER 2 TRAINING WORK UNDERTAKEN 10- 2.1 Calculator 10 2.2 Fantasy Cricket Game 12 CHAPTER 3 RESULTS AND DISCUSSION 16 3.1 Result 16 CHAPTER 4 CONCLUSION AND FUTURE SCOPE 17- 4.1 Conclusion 17 4.2 Future Scope 18 REFERENCES 19
Course modules: - Introduction to Python This module explained the basics of Python, its development and about different Environment and Tools used Python. Using Variables in Python This module had a brief course about variables in Python Programming Language: o Data Types and Variables o Numeric Data Types o String Data Type o Sequence Data Type o Dictionary Data Type Basics of Programming in Python o Understanding Programs and Programming o Using conditionals o Using Loops o Using Functions o Using Functions from Built-in Modules o Constructing Modules and Packages Principles of Object-oriented Programming o Overview of OOP o Declaring Class and Creating Objects o Understanding Inheritance o Using Magic Methods Connecting to SQLite Database o Introduction to SQL o Creating a SQLite database o Accessing SQLite Database through Python Developing a GUI with PyQT o GUI and event driven Programming o Qt Designer o Layout Managers o Using Common Widgets o Designing a Menu System Application of Python in various Disciplines o Application of Python in various Disciplines
Conditions: Python uses boolean variables to evaluate conditions. The boolean values True and False are returned when an expression is compared or evaluated. For example: x = 2 print(x == 2) # prints out True print(x == 3) # prints out False print(x < 3) # prints out True Boolean operators: The "and" and "or" boolean operators allow building complex boolean expressions, for example: name = "John" age = 23 if name == "John" and age == 23: print("Your name is John, and you are also 23 years old.") if name == "John" or name == "Rick": print("Your name is either John or Rick.") The "in" operator: The "in" operator could be used to check if a specified object exists within an iterable object container, such as a list: name = "John" if name in ["John", "Rick"]: print("Your name is either John or Rick.") Python uses indentation to define code blocks, instead of brackets. The standard Python indentation is 4 spaces, although tabs and any other space size will work, as long as it is consistent. Notice that code blocks do not need any termination. Here is an example for using Python's "if" statement using code blocks: _statement = False another_statement = True if statement is True:
_pass elif another_statement is True: # else if
pass else:
Pass_ The 'is' operator: Unlike the double equals operator "==", the "is" operator does not match the values of the variables, but the instances themselves. For example: x = [1,2,3] y = [1,2,3] print(x == y) # Prints out True print(x is y) # Prints out False The "not" operator: Using "not" before a boolean expression inverts it: print(not False) # Prints out True print((not False) == (False)) # Prints out False Loops: There are two types of loops in Python, for and while. The "for" loop: For loops iterate over a given sequence. Here is an example: primes = [2, 3, 5, 7] for prime in primes: print(prime) For loops can iterate over a sequence of numbers using the "range" and "xrange" functions. The difference between range and xrange is that the range function returns a new list with numbers of that specified range, whereas xrange returns an iterator, which is more efficient. (Python 3 uses the range function, which acts like xrange). Note that the range function is zero based. _# Prints out the numbers 0,1,2,3, for x in range(5): print(x)
for x in range(3, 6): print(x)
# Prints out 1,2,3, for i in range(1, 10): if(i%5==0): break print(i) else: print("this is not printed because for loop is terminated because of break but not due to fail in condition") 1.3 DEVELOPING A GUI WITH PYQT Understanding PyQt: PyQt is a Python binding for Qt , which is a set of C++ libraries and development tools that include platform-independent abstractions for Graphical User Interfaces (GUI), as well as networking, threads, regular expressions, SQL databases, SVG, OpenGL, XML, and many other powerful features. Developed by RiverBank Computing Ltd, PyQt is available in two editions:
The normal approach is to write the code even for the widgets and for the functionalities as well. But using Qt- designer, one can simply drag and drop the widgets, which comes very useful while developing big-scale applications. 1.4 APPLICATION OF PYTHON IN VARIOUS DISCIPLINES Python supports cross-platform operating systems which makes building applications with it all the more convenient. Some of the globally known applications such as YouTube, BitTorrent, DropBox, etc. use Python to achieve their functionality.
1. Web Development Python can be used to make web-applications at a rapid rate. Why is that? It is because of the frameworks Python uses to create these applications. There is common-backend logic that goes into making these frameworks and a number of libraries that can help integrate protocols such as HTTPS, FTP, SSL etc. and even help in the processing of JSON, XML, E-Mail and so much more. Fig. 1. Some of the most well-known frameworks are Django, Flask, Pyramid. Why use a framework? The security , scalability , convenience that they provide is commendable if we compare it to starting the development of a website from scratch. 2. Game Development Python is also used in the development of interactive games. There are libraries such as PySoy which is a 3D game engine supporting Python 3, PyGame which provides functionality and a library for game development. Games such as Civilization-IV, Disney’s Toontown Online, Vega Strike etc. have been built using Python.
You can even visualize the data libraries such as Matplotlib, Seaborn, which are helpful in plotting graphs and much more. This is what Python offers you to become a Data Scientist.
5. Desktop GUI We use Python to program desktop applications. It provides the Tkinter library that can be used to develop user interfaces. There are some other useful toolkits such as the wxWidgets, Kivy, PYQT that can be used to create applications on several platforms. Fig. 1. You can start out with creating simple applications such as Calculators, To-Do apps and go ahead and create much more complicated applications. 6. Web Scraping Applications Python is a savior when it comes to pull a large amount of data from websites which can then be helpful in various real-world processes such as price comparison, job listings, research and development and much more.
After understanding the concept of GUI and PyQt, we implemented a program for a simple calculator. Below is a code snippet for the calculator: Fig. 2. _class PyCalcUi(QMainWindow):
def _createButtons(self): """Create the buttons.""" self.buttons = {} buttonsLayout = QGridLayout()
buttons = {'7': ( 0 , 0 ), '8': ( 0 , 1 ), '9': ( 0 , 2 ), '/': ( 0 , 3 ), 'C': ( 0 , 4 ), '4': ( 1 , 0 ), '5': ( 1 , 1 ), '6': ( 1 , 2 ), '*': ( 1 , 3 ), '(': ( 1 , 4 ), '1': ( 2 , 0 ), '2': ( 2 , 1 ), '3': ( 2 , 2 ), '-': ( 2 , 3 ), ')': ( 2 , 4 ), '0': ( 3 , 0 ), '00': ( 3 , 1 ), '.': ( 3 , 2 ), '+': ( 3 , 3 ), '=': ( 3 , 4 ),_
Allows user to navigate to other pages Shows the basic template Fig. 2.
Allows user to make a new team
Fig. 2.
Allows user to see the existing team that he had made. Fig. 2.
Allows user to evaluate the team that he had made.