Application Programming in Python MCA275 Introduction PPT Part 1
Application Programming in Python MCA275 Introduction PPT Part 1
D E PAR T M E N T O F C O M P U T E R S C I E N C E AN D AP P L I CAT I O N S
Index
University Mission and Vision
Department Mission and Vision
Course Outcomes (To be discussed interactively with the students) and Program
Outcome
Evaluation methods (As finalized in the meeting of subject coordinator (A))
List of students
Attendance criteria
Syllabus of the subject (Course Credits, LTP, Reference Books and E-Material for
the subject)
Academic Calendar
Scope of the subject in Computer Science & Engineering, its prerequisite and other
related subjects.
Importance of the subject in Industry/Entrepreneurial Ventures
About yourself and your area of research
Any other required material to be show to the students
SCHOOL OF ENGINEERING &TECHNOLOGY
D E PAR T M E N T O F C O M P U T E R S C I E N C E AN D AP P L I CAT I O N S
Mission
To promote a technical education for designing technological applications and
innovative ideas that contributes to the sustainable development of societies.
To foster the culture of entrepreneurship and prepare students for productive careers
in industry and academia.
To facilitate industry-academia collaboration in order to solve interdisciplinary
societal problems.
To inculcate transformative, holistic and value-based immersive learning experiences
to solve complex technological problems of modern society.
SCHOOL OF ENGINEERING & TECHNOLOGY
D E PAR T M E N T O F C O M P U T E R S C I E N C E AN D AP P L I CAT I O N S
Evaluation methods
CA
S. No. Marks Remarks
Components
1 Quiz 10 5 Quizzes
Attendance criteria
Attendance Criteria
End-Term
Continuous Mid-Term Examinatio
Assessment Examination n
Mandatory – Mandatory- Mandatory-
Attendance 75% 75 % 75 %
SCHOOL OF ENGINEERING &TECHNOLOGY
D E PAR T M E N T O F C O M P U T E R S C I E N C E AN D AP P L I CAT I O N S
Syllabus
Application Programming in Python (MCA275)
Course Outcomes
After the completion of this course, students will be able to:
CO1. Understand the concepts of Python lists, tuples, dictionaries and define the
functions to construct the programs.
CO2. Demonstrate the programs by using Python libraries, frameworks, and
exception-handling.
CO3. Implement the Object-oriented programming (OOP) concepts and file
operations.
CO4. Apply the database connectivity concept and able to work with databases by
using python programming.
CO5. Understand and apply the web development concepts.
CO6. Design real-life applications by using python programming concepts.
SCHOOL OF ENGINEERING &TECHNOLOGY
D E PAR T M E N T O F C O M P U T E R S C I E N C E AN D AP P L I CAT I O N S
Outline syllabus CO
Mapping
Scope of the subject in Computer Science & Engineering, its prerequisite and other
related subjects.
Data Science and Machine Learning: Python is widely used for data analysis,
data visualization, and machine learning tasks, due to the availability of
powerful libraries and frameworks.
Artificial Intelligence and Deep Learning: Python is the most popular language
for AI and deep learning, with libraries such as TensorFlow and PyTorch
making it easy to build complex neural network models.
Web Development: Python has a strong presence in web development, with
popular web frameworks such as Django and Flask that make it easy to build
web applications.
Scripting and Automation: Python’s simplicity and ease of use make it a
popular choice for scripting and automation tasks.
Internet of Things (IoT): IoT development is made easier with Python’s
versatility and ease of use, with a wide variety of libraries and frameworks
available.
SCHOOL OF ENGINEERING &TECHNOLOGY
D E PAR T M E N T O F C O M P U T E R S C I E N C E AN D AP P L I CAT I O N S
• TCS • Cognizant
• Infosys • Accenture
• Wipro • Capgemini
• HCL • Deloitte India
• IBM India • Amazon India
SCHOOL OF ENGINEERING &TECHNOLOGY
D E PAR T M E N T O F C O M P U T E R S C I E N C E AN D AP P L I CAT I O N S
Time Table
What is Python…?
2
2
What is Python?
Python is a popular programming
language. It was created by Guido
van Rossum( Netherlands), and
released in 1991.
It is used for:
1.Web development (server-side)
2.Software development
3.Mathematics
4.system scripting.
Program Scripting
• a program is executed (i.e. the • a script is interpreted
source is first compiled, and the
result of that compilation is • A "script" is code written in
expected) a scripting language. A
scripting language is nothing
• A "program" in general, is a
sequence of instructions but a type of programming
written so that a computer can language in which we can
perform certain task.
write code to control
another software 26
application.
What can Python do?
1. Python can be used on a server to create
web applications.
2. Python can be used alongside software to
create workflows.
3. Python can connect to database systems. It
can also read and modify files.
4. Python can be used to handle big data and
perform complex mathematics.
5. Python can be used for rapid prototyping, or
for production-ready software development.
Why Python?
1. Python works on different platforms (Windows,
Mac, Linux, Raspberry Pi, etc).
2. Python has a simple syntax similar to the English
language.
3. Python has syntax that allows developers to write
programs with fewer lines than some other
programming languages.
4. Python runs on an interpreter system, meaning
that code can be executed as soon as it is written.
This means that prototyping can be very quick.
5. Python can be treated in a procedural way, an
object-oriented way or a functional way.
Python Syntax Compared to other Programming Languages
3
1
Python Applications
1) Web Applications
We can use Python to develop web applications. It provides libraries to
handle internet protocols such as HTML and XML, JSON, Email
processing, request, beautifulSoup, Feedparser etc. It also provides
Frameworks such as Django, Pyramid, Flask etc to design and delelop
web based applications.
3) Software Development
Python is helpful for software development process. It works
3
2 as a
support language and can be used for build control and management,
testing etc.
Python Applications
4) Scientific and Numeric
Python is popular and widely used in scientific and numeric computing. Some
useful library and package are SciPy, Pandas, IPython etc. SciPy is group of
packages of engineering, science and mathematics.
5) Business Applications
Python is used to build Business applications like ERP and e-commerce systems.
Tryton is a high level application platform.
7) 3D CAD Applications
To create CAD application Fandango is a real application which provides full
features of CAD. 3
3
Python Features
Python provides many useful features which make it popular and valuable from
the other programming languages. It supports object-oriented programming,
procedural programming approaches and provides dynamic memory allocation.
2) Expressive Language
Python can perform complex tasks using a few lines of code. A simple example,
the hello world program you simply type print("Hello World"). It will take only
one line to execute, while Java or C takes multiple lines.
3) Interpreted Language
Python is an interpreted language; it means the Python program 34is executed
one line at a time. The advantage of being interpreted language, it makes
debugging easy and portable.
Python Features
4) Cross-platform Language
Python can run equally on different platforms such as Windows, Linux, UNIX,
and Macintosh, etc. So, we can say that Python is a portable language. It
enables programmers to develop the software for several competing platforms
by writing a program only once.
6) Object-Oriented Language
Python supports object-oriented language and concepts of classes and objects
come into existence. It supports inheritance, polymorphism, and encapsulation,
3
5
11. Embeddable
The code of the other programming language can use in the Python source
code. We can use Python source code in another programming language as
well. It can embed other language into our code.
3
9
Compiler Vs Interpreter
Compiler Interpreter
The compiler is faster, as conversion The interpreter runs slower as the
occurs before the program executes. execution occurs simultaneously.
Errors are detected during the Errors are identified and reported
compilation phase and displayed
before the execution of a program. during the given actual runtime.
Debugging is more complex due to Debugging is easier due to40 the line-
batch processing of the code. by-line execution of a code.
Python Architectures/Internal working of Python
Python doesn’t convert its code into machine code, something that
hardware can understand. It converts it into something called byte
code. So within Python, compilation happens, but it’s just not in a
machine language. It is into byte code (.pyc or .pyo) and this byte code
can’t be understood by the CPU. So we need an interpreter called the
Python virtual machine to execute the byte codes.
4
1
Python Architectures/Internal working of Python
4
2
Python Architectures/Internal working of Python
Python Source Code Converted into Executable Code
The Python source code goes through the following to generate an
executable code
•Step 2: After writing Python code it is then saved as a .py file in our
system. In this, there are instructions written by a Python script for the
system.
•Step 5: Within the PVM the bytecode is converted into machine code
that is the binary language consisting of 0’s and 1’s. This binary
language is only understandable by the CPU of the system as it is
highly optimized for the machine code.
•Step 6: In the last step, the final execution occurs where the CPU
executes the machine code and the final desired output will
4 come as
4
according to your program
Two ways to run a Program
Interactive mode:
Python provides us the feature to execute the Python statement one by
one at the interactive prompt. It is preferable in the case where we are
concerned about the output of each line of our Python program.
open the interactive mode, open the terminal (or command prompt)
and type python
It will open the following prompt where we can execute the Python
statement and check their impact on the console.
Two ways to run a Program
Here, we get the message "Hello World !" printed on the console.
Two ways to run a Program
Step - 1: Open the Python interactive shell, and click "File" then choose "New", it will
open a new blank script in which we can write our code.
Two ways to run a Program
Variables: Variables are used to store data in memory for later use. In Python,
variables do not need to be declared with a specific type.
Basic Structure of Python Program
Classes: Classes are used to define objects that have specific attributes and
methods. They are used to create more complex data structures and
encapsulate code.
Exceptions: Exceptions are used to handle errors that may occur during the
execution of a program.
# This is a comment
Tokens:
• The tokens can be defined as a punctuator mark, reserved words, and
each word in a statement.
• The token is the smallest unit inside the given program.
Tokens
The smallest distinct element in a Python program is called a
token. Tokens are used to construct each phrase and command in a
program. The different Python tokens include:
Keywords
In a computer language, keywords are English words with particular
importance or meaning. We cannot utilize them for any arbitrary
reason, including as names for functions or variables. They are
utilized for their unique qualities. The 33 keywords in Python
include, among others: try, break, continue, except, or, False, True,
class, and, as, assert, print, import, raise, while, for, in, not, if, elseif,
etc.
Identifiers
The names assigned to any variable, class, function, list, method,
etc., for their recognition are known as identifiers.
Tokens
Literals or Values
The constant values or data objects utilized in a source program are known as
literals. Various types of literal are supported by Python, including:
String Literals: The Python string literals are represented by text enclosed in
solo, double, or triple quotations. Examples include "Computer Programming,"
"sigma," etc. Multi-line phrases can also be written using triple quotations.
Character Literals: Another string literal is called the character literal, which
encloses the letter in single or double quotes.
Numeric Literals: These are literals that have been written as numbers. Python
supports the following three numerical literals:
Integer Literal: Contains 0 as well as positive and negative values. There are
no fractional pieces included. In addition, literals in binary, decimal, octal,
and hexadecimal are permitted.
Float Literal: It contains real numbers in the positive and negative ranges.
Fractional portions are also a part of it.
Complex Literal: This contains the numerals a+bi, where a stands for the
fundamental component and b for the complex component.
Tokens
Boolean Literals
In Python, Boolean tokens only have two possible values. Every one of
these is true or false.
Special Literals
The special literal "None" in Python exists. It is employed to signify
emptiness, the lack of values, or nothingness.
Literals Collections
List, dictionary, tuple, and sets are examples of Python literal collections.
List: It is a comma-separated list of components enclosed in square
brackets. These elements can be of any data type and can be changed.
Tuple: In round brackets, this is similar to a list having comma-separated
items or values. The values are fixed and can have any Python data type.
Dictionary: This data structure is an unordered set of key-value
combinations.
Set: It is the group of components enclosed in curly braces, "{}"
Tokens
Operators
These represent the tokens in an expression in charge of carrying out
an operation. Operands are the elements to which an operation is
executed. Operators come in binary and unary forms. Unary
operators operate on a single argument, such as complementing and
others. At the same time, the operands for binary operators require
two.
Variable
Variables
Vary + able
A variable is the name given to a memory location. A value-holding
Python variable is also known as an identifier.
name = "Rajneesh"
age = 41.5
address = "Gr Noida"
print(name)
print(age)
print(address)
Multiple Assignment:
Multiple assignments, also known as assigning values to multiple variables in a
single statement, is a feature of Python.
a,b,c=5,10,15
print (a)
print (b)
print (c)
Output:
5
10
15
Variable: Unpack A Collection
• Python allows us to extract the values
into variables. This is called unpacking.
• Example:--
• fruits = ["apple", "banana", "cherry"]
x, y, z = fruits
print(x)
print(y)
print(z)
Variable
Variable Types
There are two types of variables in Python - Local variable and Global
variable.
Local Variable
The variables that are declared within the function and have scope within
the function are known as local variables.
Example -
# Declaring a function
def add():
# Defining local variables. They has scope only within a function
a = 20
b = 30
c=a+b
Output:
print("The sum is:", c)
The sum is: 50
add()
Variable
Global Variables
Global variables can be utilized all through the program, and its
extension is in the whole program. Global variables can be used
inside or outside the function.
mainFunction()
print(x)
Input a value for the user in Python
A value can be input from the user with the help of input()
method the syntax is as follow :
THANK
YOU