Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 17

PowerPoint Presentation

on
Programming with Python
Training Details
Terminology Details
Technology Programming with Python

Start Date 1st August’ 2021

End Date 12th September’ 2021

Mode of Training Online

Training Company INTERNSHALA

Project Fantasy Cricket Game in Python

Duration Six Weeks


Contents
1. Introduction to Python.
2. Basic Programming in Python.
3. Principles of Object-Oriented Programming.
4. Connecting to SQLite Database.
5. Developing a GUI with PyQt.
6. Applications of Python in various disciplines.
7. Project.
What is Python programming language?
• A programming language is a set of rules for communicating with a system.
• Python is a high-level programming language certain examples of high-level
languages are C++, Perl, JAVA, etc.
• Python combines remarkable power with very clear syntax.
• Python is an interpreted, object-oriented, high-level programming language with
dynamic semantics.
• It is a platform-independent language.
• The Python implementation is copyrighted but freely usable & distributable even
for commercial use.
• Python supports modules and packages, which encourages program modularity
and code reuse.
Basic syntax of Python
What is the syntax? Computers are
machines that can interpret your instructions if you type them in the exact format
that the computer expects. This expected format the spelling, formatting & grammar
is called syntax.
Unlike any other language, Python uses indentation in place of syntax. Indentation
is a leading space or tab at the beginning of the line. Python
recommends 4 spaces as indentation to make the code more readable.
Keywords in Python Some
of the keywords used in python are: ‘True’
‘False’
‘None’
‘and’
‘or’
‘as’
‘def’
‘import’
Data types & Variables
Variables are nothing but reserved memory locations to store values. Based on the
data type of variable, the interpreter allocates memory & decides what can be stored
in reserved memory.
Example:
temp, Temp, TEMP, temp3, Te_Mp
A data type is an attribute associated with a piece of data that tells a computer system
how to interpret its value.
Python has 5 standard data types:
Number, String, List, Tuple, Dictionary
Python supports 2 types of numbers:
Integers & Floating point numbers.
Basic programming in Python
Python divides the operators into the following groups:
• Arithmetic Operator. (‘+’, ‘-’, ‘*’, ‘/’)
• Assignment Operator. (‘=‘, ‘+=‘)
• Comparison Operator. (‘==’, ‘!=’)
• Logical Operator. (‘and’, ‘or’, ‘not’)
• Identify Operator. (‘is’, ‘is not’)
• Bitwise Operator. (‘&’, ‘|’, ‘<<’, ‘>>’)

To write a basic python program follow these steps:


1. Open the start menu & choose Python(command line).
2. At the prompt, type the executable code.
3. Press the enter key (python runs the code you typed).
Principle of OOP
Object-oriented programming is a programming paradigm that provides a means of
structuring programs so that properties and behaviors are bundled into individual
objects.
Define a Class in Python:
Classes are used to create user-defined data structures. Classes define functions called
methods, which identify the behaviors and actions that an object created from the class
can perform with its data.
Instance Methods:
These are functions that are defined inside a class and can only be called from an
instance of that class. Just like .__init__(), an instance method’s first parameter is always
self.
Inheritance
Inheritance is a way of creating a new class for using details of an existing class without modifying
it. The newly formed class is a derived class (or child class). Similarly, the existing class is a base
class (or parent class).
Example:
Encapsulation
Using OOP in Python, we can restrict access to methods and variables. This prevents
data from direct modification which is called encapsulation. In Python, we denote
private attributes using underscore as the prefix i.e. single [_] or double [__].
Polymorphism
Polymorphism is the ability to use a common interface for multiple forms (data types).
Suppose, we need to
color a shape, there are multiple shape options (rectangle, square, circle). However, we could
use the same method to color any shape. This concept is called Polymorphism.
Connecting to SQLite Database
SQLite is a C library that provides a lightweight disk-based database that doesn’t require
a separate server process & allows accessing the database using a nonstandard variant
of SQL query language.
Connecting to SQLite database:
- Use the connect() method of a sqlite2 module & pass the database name as an
argument.
- Create the cursor object using the connection object returned by the connect method
to execute SQLite queries from python.
- Close the cursor object & SQLite database connection object when work is done.
- Catch database exceptions if any that may occur during this connection process.
Developing a GUI with PyQT
PyQT is a Python binding for Qt, which is a set of c++ libraries & development tools that
include platform independent abstractions for graphical user interfaces(GUI).
Installing PyQT:
For Linux: sudo apt-get install python3-pyqt5
For Windows: pip install pyqt5 pip install pyqt5-tools To create the layout of Sing up
form, the following widgets
are needed:
1. Three edit boxes
2. One button
3. Four text labels(Sign ID
Banner, label, Password
and Confirm Password
label)
1. One has to find those widgets in Widget Tool Box. Just drag and drop the required
widgets onto the Main Window or the window working on.
2. To change the appearance of the window or the widget, just right-click on the
widget and click Change Style Sheet.
Application of Python
Python supports cross-platform operating systems which makes building applications
with it all the convenient. Ex. YouTube, Drop box, Bit Torrent etc.
1. Web Development
2. Game Development
3. Machine learning & artificial intelligence
4. Data science & data visualization
5. Desktop GUI
6. Web scrapping applications
7. Business Applications
8. Audio & video applications
9. Embedded applications
Project
Making Fantasy Cricket Game using Python.
Thank you

You might also like