Summer Training Report on Fantacy Cricket Game using Python, Summaries of Computer Science

It is a training report of a fantacy cricket game.

Typology: Summaries

2019/2020

Uploaded on 09/17/2021

swampy.sweety
swampy.sweety 🇮🇳

4.7

(3)

1 document

1 / 26

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
SUMMER TRAINING REPORT
ON
FANTASY CRICKET (Programming with Python)
SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENT FOR THE AWARD
OF THE DEGREE OF
BACHELOR OF ENGINEERING
Computer Science & Engineering
MAY-JUNE,2020
SUBMITTED BY:
NAME: Shivangi
UNIVERSITY UID: 18BCS2347
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
CHANDIGARH UNIVERSITY GHARUAN, MOHALI
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a

Partial preview of the text

Download Summer Training Report on Fantacy Cricket Game using Python and more Summaries Computer Science in PDF only on Docsity!

SUMMER TRAINING REPORT

ON

FANTASY CRICKET (Programming with Python)

SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENT FOR THE AWARD

OF THE DEGREE OF

BACHELOR OF ENGINEERING

Computer Science & Engineering

MAY-JUNE,

SUBMITTED BY:

NAME: Shivangi UNIVERSITY UID: 18BCS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

CHANDIGARH UNIVERSITY GHARUAN, MOHALI

CERTIFICATE BY COURSE WEBSITE

ABSTRACT

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

ACKNOWLEDGEMENT

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.

CONTENTS

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

Chapter 1: INTRODUCTION

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

1.2 BASICS OF PROGRAMMING IN PYTHON

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:

do something_

_pass elif another_statement is True: # else if

do something else

pass else:

do another thing

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)

Prints out 3,4,

for x in range(3, 6): print(x)

Prints out 3,5,_

# 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:

  1. PyQt4: an edition that’s built against Qt 4.x and 5.x
  2. PyQt5: an edition that’s only built against Qt 5.x Even though PyQt4 can be built against Qt 5.x, only a small subset that is also compatible with Qt 4.x will be supported. This means that if you decide to use PyQt4, then you’ll probably miss out on some of the new features and improvements in PyQt5. PyQt5 is based on Qt v5 and includes classes that cover Graphical User Interfaces as well as XML handling, network communication, regular expressions, threads, SQL databases, multimedia, web browsing, and other technologies available in Qt. PyQt5 implements over one thousands of these Qt classes in a set of Python modules, all of which are contained within a top-level Python package called PyQt5. PyQt5 is compatible with Windows, Unix, Linux, macOS, iOS, and Android. This can be an attractive feature if you’re looking for a library or framework to develop multi-platform applications with a native look and feel on each platform. PyQt5 is available under two licenses:
  3. The Riverbank Commercial License
  4. The General Public License (GPL), version 3 Your PyQt5 license must be compatible with your Qt license. If you use the GPL version, then your code must also use a GPL-compatible license. If you want to use PyQt5 to create commercial applications, then you’ll need a commercial license for your installation. Designing GUI applications Using PyQt in Python: Last Updated: 13-10- Building GUI applications using PYQT designer tool is comparatively less time consuming than code the widgets. It is one of the fastest and easiest ways to create GUIs.

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.

Chapter 2: TRAINING WORK UNDERTAKEN

2.1 CALCULATOR

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):

Snip

def _createButtons(self): """Create the buttons.""" self.buttons = {} buttonsLayout = QGridLayout()

Button text | position on the 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 ),_

2.2 FANTASY CRICKET GAME

2.2.1: Main window

 Allows user to navigate to other pages  Shows the basic template Fig. 2.

2.2.2: New Team

 Allows user to make a new team

Fig. 2.

2.2.3: Open Team

 Allows user to see the existing team that he had made. Fig. 2.

2.2.3: Evaluate Team

 Allows user to evaluate the team that he had made.