SlideShare a Scribd company logo
OBJECT ORIENTED
PROGRAMMING
Lec: CSIT362 / CSIT362A
Lab: CSIT361L / CSIT361A-L
Prof. Percival A. Fernandez
ADVANCED PYTHON
PROGRAMMING
Lec: CSDS042
Lab: CSDS041L
Prof. Percival A. Fernandez
Module 1 Review of Python Basics An Introduction
• Python is a popular programming language. It was created by Guido van Rossum, and
released in 1991.
• It is used for:
• web development (server-side),
• software development,
• mathematics,
• system scripting.
What is Python
Prof. Percival A. Fernandez
• Python is a high-level, general-purpose and a very popular programming language.
Python programming language (latest Python 3) is being used in web development,
Machine Learning applications, along with all cutting edge technology in Software
Industry.
• Python Programming Language is very well suited for Beginners, also for experienced
programmers with other programming languages like C++ and Java.
Prof. Percival A. Fernandez
What is Python
• Python is a very popular general-purpose interpreted, interactive, object-oriented, and
high-level programming language.
• Python is dynamically-typed and garbage-collected programming language. It was
created by Guido van Rossum during 1985- 1990. Python is a popular programming
language.
Prof. Percival A. Fernandez
What is Python
• If you know Python nicely, then you have a great career ahead. Here are just a few of
the career options where Python is a key skill:
▪ Game developer
▪ Web designer
▪ Python developer
▪ Full-stack developer
▪ Machine learning engineer
▪ Data scientist
Prof. Percival A. Fernandez
Careers with Python
▪Data analyst
▪Data engineer
▪DevOps engineer
▪Software engineer
▪Many more other roles
• Python is currently the most widely used multi-purpose, high-level programming
language.
• Python allows programming in Object-Oriented and Procedural paradigms.
• Python programs generally are smaller than other programming languages like Java.
Programmers have to type relatively less and indentation requirement of the
language, makes them readable all the time.
• Python language is being used by almost all tech-giant companies like – Google,
Amazon, Facebook, Instagram, Dropbox, Uber… etc.
Prof. Percival A. Fernandez
Facts about Python
• The biggest strength of Python is huge collection of standard library which can be
used for the following:
• Machine Learning
• GUI Applications (like Kivy, Tkinter, PyQt etc. )
• Web frameworks like Django (used by YouTube, Instagram, Dropbox)
• Image processing (like OpenCV, Pillow)
• Web scraping (like Scrapy, BeautifulSoup, Selenium)
Prof. Percival A. Fernandez
Facts about Python
• The biggest strength of Python is huge collection of standard library which can be
used for the following – cont.:
• Test frameworks
• Multimedia
• Scientific computing
• Text processing and many more..
Prof. Percival A. Fernandez
Facts about Python
• Python is consistently rated as one of the world's most popular programming
languages.
• Python is fairly easy to learn, so if you are starting to learn any programming language
then Python could be your great choice.
• Today various Schools, Colleges and Universities are teaching Python as their primary
programming language.
Prof. Percival A. Fernandez
Why to learn Python
• There are many other good reasons which makes Python as the top choice of any
programmer:
▪ Python is Open Source which means its available free of cost.
▪ Python is simple and so easy to learn
▪ Python is versatile and can be used to create many different things.
▪ Python has powerful development libraries include AI, ML etc.
▪ Python is much in demand and ensures high salary
Prof. Percival A. Fernandez
Why to learn Python
• Python is a MUST for students and working professionals to become a great Software
Engineer specially when they are working in Web Development Domain.
▪ Python is Interpreted − Python is processed at runtime by the interpreter. You do
not need to compile your program before executing it. This is similar to PERL and
PHP.
▪ Python is Interactive − You can actually sit at a Python prompt and interact with
the interpreter directly to write your programs.
Prof. Percival A. Fernandez
Why to learn Python
▪ Python is Object-Oriented − Python supports Object-Oriented style or technique
of programming that encapsulates code within objects.
▪ Python is a Beginner's Language − Python is a great language for the beginner-
level programmers and supports the development of a wide range of applications
from simple text processing to WWW browsers to games.
Prof. Percival A. Fernandez
Why to learn Python
• Following are important characteristics of Python Programming −
▪ It supports functional and structured programming methods as well as OOP.
▪ It can be used as a scripting language or can be compiled to byte-code for building
large applications.
▪ It provides very high-level dynamic data types and supports dynamic type
checking.
▪ It supports automatic garbage collection.
▪ It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.
Prof. Percival A. Fernandez
Characteristics of Python
• The latest release of Python is 3.x. As mentioned before, Python is one of the most
widely used language over the web. I'm going to list few of them here:
• Easy-to-learn − Python has few keywords, simple structure, and a clearly defined
syntax. This allows the student to pick up the language quickly.
• Easy-to-read − Python code is more clearly defined and visible to the eyes.
• Easy-to-maintain − Python's source code is fairly easy-to-maintain.
• A broad standard library − Python's bulk of the library is very portable and cross-
platform compatible on UNIX, Windows, and Macintosh.
Prof. Percival A. Fernandez
Reasons Python
• Interactive Mode − Python has support for an interactive mode which allows
interactive testing and debugging of snippets of code.
• Portable − Python can run on a wide variety of hardware platforms and has the
same interface on all platforms.
• Extendable − You can add low-level modules to the Python interpreter. These modules
enable programmers to add to or customize their tools to be more efficient.
Prof. Percival A. Fernandez
Reasons to use Python
• Databases − Python provides interfaces to all major commercial databases.
• GUI Programming − Python supports GUI applications that can be created and
ported to many system calls, libraries and windows systems, such as Windows
MFC, Macintosh, and the X Window system of Unix.
• Scalable − Python provides a better structure and support for large programs than
shell scripting.
Prof. Percival A. Fernandez
Reasons to use Python
• Python was designed for readability, and has some similarities to the English
language with influence from mathematics.
• Python uses new lines to complete a command, as opposed to other programming
languages which often use semicolons or parentheses.
• Python relies on indentation, using whitespace, to define scope; such as the scope of
loops, functions and classes. Other programming languages often use curly-brackets
for this purpose.
Prof. Percival A. Fernandez
Python Syntax compared to other programming languages
• The Python syntax defines a set of rules that are used to create Python statements
while writing a Python Program.
• The Python Programming Language Syntax has many similarities to Perl, C, and Java
Programming Languages. However, there are some definite differences between the
languages.
• Python syntax can be executed by writing directly in the Command Line:
Prof. Percival A. Fernandez
Python - Basic Syntax
• Or by creating a python file on the server, using the .py file extension, and running it in
the Command Line:
Prof. Percival A. Fernandez
Python - Basic Syntax
• Indentation refers to the spaces at the beginning of a code line.
• Where in other programming languages the indentation in code is for readability only,
the indentation in Python is very important.
• Python uses indentation to indicate a block of code.
• The number of spaces is up to you as a programmer, the most common use is four, but
it has to be at least one.
Prof. Percival A. Fernandez
Python Indentation
❖Python - Interactive Mode Programming
• We can invoke a Python interpreter from command line by typing python at the
command prompt as following −
• Here >>> denotes a Python Command Prompt where you can type your
commands. Let's type the following text at the Python prompt and press the Enter
−
Prof. Percival A. Fernandez
Example Python Program
❖Python - Script Mode Programming
▪ We can invoke the Python interpreter with a script parameter which begins the
execution of the script and continues until the script is finished. When the script is
finished, the interpreter is no longer active.
▪ Let us write a simple Python program in a script which is simple text file. Python
files have extension .py. Type the following source code in a test.py file −
• We assume that you have Python interpreter path set in PATH variable. Now, let's
try to run this program as follows −
Prof. Percival A. Fernandez
Example Python Program
• Comments can be used to explain Python code.
• Comments can be used to make the code more readable.
• Comments can be used to prevent execution when testing code.
• Creating a Comment
• Comments starts with a #, and Python will ignore them:
• Comments can be placed at the end of a line, and Python will ignore the rest of the
line:
Prof. Percival A. Fernandez
Python Comments
• A Python identifier is a name used to identify a variable, function, class, module or
other object. An identifier starts with a letter A to Z or a to z or an underscore (_)
followed by zero or more letters, underscores and digits (0 to 9).
• Python does not allow punctuation characters such as @, $, and % within identifiers.
• Variables are containers for storing data values.
• Creating Variables
• Python has no command for declaring a variable.
• A variable is created the moment you first assign a value to it.
Prof. Percival A. Fernandez
Python Identifiers
• Casting
• If you want to specify the data type of a variable, this can be done with
casting.
Prof. Percival A. Fernandez
Python Identifiers
• Single or Double Quotes?
• String variables can be declared either by using single or double quotes:
• Case-Sensitive
• Variable names are case-sensitive.
#A will not overwrite a
Prof. Percival A. Fernandez
Python Identifiers
• Python programming provides no braces to indicate blocks of code for class and
function definitions or flow control. Blocks of code are denoted by line indentation,
which is rigidly enforced.
• The number of spaces in the indentation is variable, but all statements within the
block must be indented the same amount. For example −
• However, the following block generates an error −
Thus, in Python all the continuous lines indented with same
number of spaces would form a block.
Prof. Percival A. Fernandez
Python Lines and Indentation
• Python Data Types are used to define the type of a variable. It defines what type of
data we are going to store in a variable. The data stored in memory can be of many
types.
• For example, a person's age is stored as a numeric value and his or her address is
stored as alphanumeric characters.
Prof. Percival A. Fernandez
Python Data Types
Prof. Percival A. Fernandez
Python Data Types
• Python numeric data types store numeric values. Number objects are created when
you assign a value to them. For example −
• Python supports four different numerical types −
• int (signed integers)
• long (long integers, they can also be
represented in octal and hexadecimal)
• float (floating point real values)
• complex (complex numbers)
Prof. Percival A. Fernandez
Python Numeric Data Type
• Python Strings are identified as a contiguous set of characters represented in the
quotation marks. Python allows for either pairs of single or double quotes.
• Subsets of strings can be taken using the slice operator ([ ] and [:] ) with indexes
starting at 0 in the beginning of the string and working their way from -1 at the end.
• The plus (+) sign is the string concatenation operator and the asterisk (*) is the
repetition operator in Python. For example −
Prof. Percival A. Fernandez
Python String Data Type
• Operators are used to perform operations on variables and values.
• Python divides the operators in the following groups:
• Arithmetic operators
• Assignment operators
• Comparison operators
• Logical operators
• Identity operators
Prof. Percival A. Fernandez
Python Operators
• Membership operators
• Bitwise operators
• Python arithmetic operators are used to perform
mathematical operations on numerical values. These
operations are Addition, Subtraction, Multiplication,
Division, Modulus, Exponents and Floor Division.
This produce the following
result −
Prof. Percival A. Fernandez
Python Arithmetic Operators
• Python comparison operators compare the values on either
sides of them and decide the relation among them. They are
also called relational operators. These operators are equal,
not equal, greater than, less than, greater than or equal to
and less than or equal to.
This produce the following result −
Prof. Percival A. Fernandez
Python Comparison Operators
• Python assignment operators are used to assign values to
variables. These operators include simple assignment
operator, addition assign, subtraction assign, multiplication
assign, division and assign operators etc.
This produce the following result −
Prof. Percival A. Fernandez
Python Assignment Operators
• https://www.python.org/about/gettingstarted/
• https://wiki.python.org/moin/BeginnersGuide/Download
• https://www.tutorialspoint.com/python/python_environment.htm
• https://www.w3schools.com/python/python_getstarted.asp
• https://realpython.com/installing-python/
• https://www.python.org/about/gettingstarted/
• https://www.tutorialspoint.com/python/index.htm
• https://www.geeksforgeeks.org/python-programming-language/
• https://www.w3schools.com/python/default.asp
Prof. Percival A. Fernandez
References:
Ad

More Related Content

Similar to Module 1 Review of Python Basics An Introduction (20)

Python Programming Unit1_Aditya College of Engg & Tech
Python Programming Unit1_Aditya College of Engg & TechPython Programming Unit1_Aditya College of Engg & Tech
Python Programming Unit1_Aditya College of Engg & Tech
Ramanamurthy Banda
 
Introduction to Python Programming Basics
Introduction  to  Python  Programming BasicsIntroduction  to  Python  Programming Basics
Introduction to Python Programming Basics
Dhana malar
 
What is Python Programming for Beginners
What is Python Programming for BeginnersWhat is Python Programming for Beginners
What is Python Programming for Beginners
Rakesh Kumar R
 
Python slide basic to advanced english tutorial
Python slide basic to advanced english tutorialPython slide basic to advanced english tutorial
Python slide basic to advanced english tutorial
masukmia.com
 
Python
PythonPython
Python
Learnbay Datascience
 
An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()
Blue Elephant Consulting
 
Python notes for beginners - in simple sentences
Python notes for beginners - in simple sentencesPython notes for beginners - in simple sentences
Python notes for beginners - in simple sentences
RajyalakshmiUmmadise
 
PHP vs Python Which is Best for Web Development.pdf
PHP vs Python Which is Best for Web Development.pdfPHP vs Python Which is Best for Web Development.pdf
PHP vs Python Which is Best for Web Development.pdf
christiemarie4
 
What is Python ? Why its important ? Institute for Python Course.
What is Python ? Why its important ? Institute for Python Course.What is Python ? Why its important ? Institute for Python Course.
What is Python ? Why its important ? Institute for Python Course.
Excellence Technology
 
Python Introduction.ppt
Python Introduction.pptPython Introduction.ppt
Python Introduction.ppt
RupaBhattacharya6
 
Presentation (1).pdf
Presentation (1).pdfPresentation (1).pdf
Presentation (1).pdf
naganeparth06
 
Python Programming and ApplicationsUnit-1.docx
Python Programming and ApplicationsUnit-1.docxPython Programming and ApplicationsUnit-1.docx
Python Programming and ApplicationsUnit-1.docx
Manohar k
 
Introduction-to-Python-Programming1.pptx
Introduction-to-Python-Programming1.pptxIntroduction-to-Python-Programming1.pptx
Introduction-to-Python-Programming1.pptx
vijayalakshmi257551
 
Python
PythonPython
Python
onlinetraining3
 
python intro and installation.pptx
python intro and installation.pptxpython intro and installation.pptx
python intro and installation.pptx
adityakumawat625
 
introduction to Python (for beginners)
introduction to Python (for beginners)introduction to Python (for beginners)
introduction to Python (for beginners)
guobichrng
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
AnirudhaGaikwad4
 
python training in chandigarh
python     training    in     chandigarhpython     training    in     chandigarh
python training in chandigarh
priyansuthakur59093
 
Python Course In Chandigarh And Mohali
Python Course  In  Chandigarh And MohaliPython Course  In  Chandigarh And Mohali
Python Course In Chandigarh And Mohali
dhimxn21o7
 
Top Five Reasons for Choosing Python Programming
Top Five Reasons for Choosing Python Programming  Top Five Reasons for Choosing Python Programming
Top Five Reasons for Choosing Python Programming
Lesa Cote
 
Python Programming Unit1_Aditya College of Engg & Tech
Python Programming Unit1_Aditya College of Engg & TechPython Programming Unit1_Aditya College of Engg & Tech
Python Programming Unit1_Aditya College of Engg & Tech
Ramanamurthy Banda
 
Introduction to Python Programming Basics
Introduction  to  Python  Programming BasicsIntroduction  to  Python  Programming Basics
Introduction to Python Programming Basics
Dhana malar
 
What is Python Programming for Beginners
What is Python Programming for BeginnersWhat is Python Programming for Beginners
What is Python Programming for Beginners
Rakesh Kumar R
 
Python slide basic to advanced english tutorial
Python slide basic to advanced english tutorialPython slide basic to advanced english tutorial
Python slide basic to advanced english tutorial
masukmia.com
 
An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()
Blue Elephant Consulting
 
Python notes for beginners - in simple sentences
Python notes for beginners - in simple sentencesPython notes for beginners - in simple sentences
Python notes for beginners - in simple sentences
RajyalakshmiUmmadise
 
PHP vs Python Which is Best for Web Development.pdf
PHP vs Python Which is Best for Web Development.pdfPHP vs Python Which is Best for Web Development.pdf
PHP vs Python Which is Best for Web Development.pdf
christiemarie4
 
What is Python ? Why its important ? Institute for Python Course.
What is Python ? Why its important ? Institute for Python Course.What is Python ? Why its important ? Institute for Python Course.
What is Python ? Why its important ? Institute for Python Course.
Excellence Technology
 
Presentation (1).pdf
Presentation (1).pdfPresentation (1).pdf
Presentation (1).pdf
naganeparth06
 
Python Programming and ApplicationsUnit-1.docx
Python Programming and ApplicationsUnit-1.docxPython Programming and ApplicationsUnit-1.docx
Python Programming and ApplicationsUnit-1.docx
Manohar k
 
Introduction-to-Python-Programming1.pptx
Introduction-to-Python-Programming1.pptxIntroduction-to-Python-Programming1.pptx
Introduction-to-Python-Programming1.pptx
vijayalakshmi257551
 
python intro and installation.pptx
python intro and installation.pptxpython intro and installation.pptx
python intro and installation.pptx
adityakumawat625
 
introduction to Python (for beginners)
introduction to Python (for beginners)introduction to Python (for beginners)
introduction to Python (for beginners)
guobichrng
 
Python Course In Chandigarh And Mohali
Python Course  In  Chandigarh And MohaliPython Course  In  Chandigarh And Mohali
Python Course In Chandigarh And Mohali
dhimxn21o7
 
Top Five Reasons for Choosing Python Programming
Top Five Reasons for Choosing Python Programming  Top Five Reasons for Choosing Python Programming
Top Five Reasons for Choosing Python Programming
Lesa Cote
 

More from percivalfernandez2 (8)

Module 2-Review of Python Decision making and Loops.pdf
Module 2-Review of Python Decision making and Loops.pdfModule 2-Review of Python Decision making and Loops.pdf
Module 2-Review of Python Decision making and Loops.pdf
percivalfernandez2
 
Wk_10_Scanner and BufferedReader Class in Java.pptx
Wk_10_Scanner and BufferedReader Class in Java.pptxWk_10_Scanner and BufferedReader Class in Java.pptx
Wk_10_Scanner and BufferedReader Class in Java.pptx
percivalfernandez2
 
Module 3 - Software Classification.pptx
Module 3 - Software Classification.pptxModule 3 - Software Classification.pptx
Module 3 - Software Classification.pptx
percivalfernandez2
 
Data Analytics.pptx
Data Analytics.pptxData Analytics.pptx
Data Analytics.pptx
percivalfernandez2
 
Python Programming Part 8 - MYSQL.pptx
Python Programming Part 8 - MYSQL.pptxPython Programming Part 8 - MYSQL.pptx
Python Programming Part 8 - MYSQL.pptx
percivalfernandez2
 
Wk8_Expansion and External Input and Output Devices.pptx
Wk8_Expansion and External Input and Output Devices.pptxWk8_Expansion and External Input and Output Devices.pptx
Wk8_Expansion and External Input and Output Devices.pptx
percivalfernandez2
 
Advance C# Programming Part 1.pdf
Advance C# Programming Part 1.pdfAdvance C# Programming Part 1.pdf
Advance C# Programming Part 1.pdf
percivalfernandez2
 
Python Programming Part 3.pdf
Python Programming Part 3.pdfPython Programming Part 3.pdf
Python Programming Part 3.pdf
percivalfernandez2
 
Module 2-Review of Python Decision making and Loops.pdf
Module 2-Review of Python Decision making and Loops.pdfModule 2-Review of Python Decision making and Loops.pdf
Module 2-Review of Python Decision making and Loops.pdf
percivalfernandez2
 
Wk_10_Scanner and BufferedReader Class in Java.pptx
Wk_10_Scanner and BufferedReader Class in Java.pptxWk_10_Scanner and BufferedReader Class in Java.pptx
Wk_10_Scanner and BufferedReader Class in Java.pptx
percivalfernandez2
 
Module 3 - Software Classification.pptx
Module 3 - Software Classification.pptxModule 3 - Software Classification.pptx
Module 3 - Software Classification.pptx
percivalfernandez2
 
Python Programming Part 8 - MYSQL.pptx
Python Programming Part 8 - MYSQL.pptxPython Programming Part 8 - MYSQL.pptx
Python Programming Part 8 - MYSQL.pptx
percivalfernandez2
 
Wk8_Expansion and External Input and Output Devices.pptx
Wk8_Expansion and External Input and Output Devices.pptxWk8_Expansion and External Input and Output Devices.pptx
Wk8_Expansion and External Input and Output Devices.pptx
percivalfernandez2
 
Advance C# Programming Part 1.pdf
Advance C# Programming Part 1.pdfAdvance C# Programming Part 1.pdf
Advance C# Programming Part 1.pdf
percivalfernandez2
 
Ad

Recently uploaded (20)

Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
APM Midlands Region April 2025 Sacha Hind Circulated.pdf
APM Midlands Region April 2025 Sacha Hind Circulated.pdfAPM Midlands Region April 2025 Sacha Hind Circulated.pdf
APM Midlands Region April 2025 Sacha Hind Circulated.pdf
Association for Project Management
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
dynastic art of the Pallava dynasty south India
dynastic art of the Pallava dynasty south Indiadynastic art of the Pallava dynasty south India
dynastic art of the Pallava dynasty south India
PrachiSontakke5
 
"Basics of Heterocyclic Compounds and Their Naming Rules"
"Basics of Heterocyclic Compounds and Their Naming Rules""Basics of Heterocyclic Compounds and Their Naming Rules"
"Basics of Heterocyclic Compounds and Their Naming Rules"
rupalinirmalbpharm
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Kenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 CohortKenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 Cohort
EducationNC
 
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
Nguyen Thanh Tu Collection
 
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE  BY sweety Tamanna Mahapatra MSc PediatricAPGAR SCORE  BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
SweetytamannaMohapat
 
Operations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdfOperations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdf
Arab Academy for Science, Technology and Maritime Transport
 
Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...
Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...
Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...
National Information Standards Organization (NISO)
 
PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)
PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)
PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)
Dr. Nasir Mustafa
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
Grade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable WorksheetGrade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable Worksheet
Sritoma Majumder
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
dynastic art of the Pallava dynasty south India
dynastic art of the Pallava dynasty south Indiadynastic art of the Pallava dynasty south India
dynastic art of the Pallava dynasty south India
PrachiSontakke5
 
"Basics of Heterocyclic Compounds and Their Naming Rules"
"Basics of Heterocyclic Compounds and Their Naming Rules""Basics of Heterocyclic Compounds and Their Naming Rules"
"Basics of Heterocyclic Compounds and Their Naming Rules"
rupalinirmalbpharm
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Kenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 CohortKenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 Cohort
EducationNC
 
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
Nguyen Thanh Tu Collection
 
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE  BY sweety Tamanna Mahapatra MSc PediatricAPGAR SCORE  BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
SweetytamannaMohapat
 
PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)
PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)
PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)
Dr. Nasir Mustafa
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
Grade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable WorksheetGrade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable Worksheet
Sritoma Majumder
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
Ad

Module 1 Review of Python Basics An Introduction

  • 1. OBJECT ORIENTED PROGRAMMING Lec: CSIT362 / CSIT362A Lab: CSIT361L / CSIT361A-L Prof. Percival A. Fernandez
  • 2. ADVANCED PYTHON PROGRAMMING Lec: CSDS042 Lab: CSDS041L Prof. Percival A. Fernandez
  • 4. • Python is a popular programming language. It was created by Guido van Rossum, and released in 1991. • It is used for: • web development (server-side), • software development, • mathematics, • system scripting. What is Python Prof. Percival A. Fernandez
  • 5. • Python is a high-level, general-purpose and a very popular programming language. Python programming language (latest Python 3) is being used in web development, Machine Learning applications, along with all cutting edge technology in Software Industry. • Python Programming Language is very well suited for Beginners, also for experienced programmers with other programming languages like C++ and Java. Prof. Percival A. Fernandez What is Python
  • 6. • Python is a very popular general-purpose interpreted, interactive, object-oriented, and high-level programming language. • Python is dynamically-typed and garbage-collected programming language. It was created by Guido van Rossum during 1985- 1990. Python is a popular programming language. Prof. Percival A. Fernandez What is Python
  • 7. • If you know Python nicely, then you have a great career ahead. Here are just a few of the career options where Python is a key skill: ▪ Game developer ▪ Web designer ▪ Python developer ▪ Full-stack developer ▪ Machine learning engineer ▪ Data scientist Prof. Percival A. Fernandez Careers with Python ▪Data analyst ▪Data engineer ▪DevOps engineer ▪Software engineer ▪Many more other roles
  • 8. • Python is currently the most widely used multi-purpose, high-level programming language. • Python allows programming in Object-Oriented and Procedural paradigms. • Python programs generally are smaller than other programming languages like Java. Programmers have to type relatively less and indentation requirement of the language, makes them readable all the time. • Python language is being used by almost all tech-giant companies like – Google, Amazon, Facebook, Instagram, Dropbox, Uber… etc. Prof. Percival A. Fernandez Facts about Python
  • 9. • The biggest strength of Python is huge collection of standard library which can be used for the following: • Machine Learning • GUI Applications (like Kivy, Tkinter, PyQt etc. ) • Web frameworks like Django (used by YouTube, Instagram, Dropbox) • Image processing (like OpenCV, Pillow) • Web scraping (like Scrapy, BeautifulSoup, Selenium) Prof. Percival A. Fernandez Facts about Python
  • 10. • The biggest strength of Python is huge collection of standard library which can be used for the following – cont.: • Test frameworks • Multimedia • Scientific computing • Text processing and many more.. Prof. Percival A. Fernandez Facts about Python
  • 11. • Python is consistently rated as one of the world's most popular programming languages. • Python is fairly easy to learn, so if you are starting to learn any programming language then Python could be your great choice. • Today various Schools, Colleges and Universities are teaching Python as their primary programming language. Prof. Percival A. Fernandez Why to learn Python
  • 12. • There are many other good reasons which makes Python as the top choice of any programmer: ▪ Python is Open Source which means its available free of cost. ▪ Python is simple and so easy to learn ▪ Python is versatile and can be used to create many different things. ▪ Python has powerful development libraries include AI, ML etc. ▪ Python is much in demand and ensures high salary Prof. Percival A. Fernandez Why to learn Python
  • 13. • Python is a MUST for students and working professionals to become a great Software Engineer specially when they are working in Web Development Domain. ▪ Python is Interpreted − Python is processed at runtime by the interpreter. You do not need to compile your program before executing it. This is similar to PERL and PHP. ▪ Python is Interactive − You can actually sit at a Python prompt and interact with the interpreter directly to write your programs. Prof. Percival A. Fernandez Why to learn Python
  • 14. ▪ Python is Object-Oriented − Python supports Object-Oriented style or technique of programming that encapsulates code within objects. ▪ Python is a Beginner's Language − Python is a great language for the beginner- level programmers and supports the development of a wide range of applications from simple text processing to WWW browsers to games. Prof. Percival A. Fernandez Why to learn Python
  • 15. • Following are important characteristics of Python Programming − ▪ It supports functional and structured programming methods as well as OOP. ▪ It can be used as a scripting language or can be compiled to byte-code for building large applications. ▪ It provides very high-level dynamic data types and supports dynamic type checking. ▪ It supports automatic garbage collection. ▪ It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java. Prof. Percival A. Fernandez Characteristics of Python
  • 16. • The latest release of Python is 3.x. As mentioned before, Python is one of the most widely used language over the web. I'm going to list few of them here: • Easy-to-learn − Python has few keywords, simple structure, and a clearly defined syntax. This allows the student to pick up the language quickly. • Easy-to-read − Python code is more clearly defined and visible to the eyes. • Easy-to-maintain − Python's source code is fairly easy-to-maintain. • A broad standard library − Python's bulk of the library is very portable and cross- platform compatible on UNIX, Windows, and Macintosh. Prof. Percival A. Fernandez Reasons Python
  • 17. • Interactive Mode − Python has support for an interactive mode which allows interactive testing and debugging of snippets of code. • Portable − Python can run on a wide variety of hardware platforms and has the same interface on all platforms. • Extendable − You can add low-level modules to the Python interpreter. These modules enable programmers to add to or customize their tools to be more efficient. Prof. Percival A. Fernandez Reasons to use Python
  • 18. • Databases − Python provides interfaces to all major commercial databases. • GUI Programming − Python supports GUI applications that can be created and ported to many system calls, libraries and windows systems, such as Windows MFC, Macintosh, and the X Window system of Unix. • Scalable − Python provides a better structure and support for large programs than shell scripting. Prof. Percival A. Fernandez Reasons to use Python
  • 19. • Python was designed for readability, and has some similarities to the English language with influence from mathematics. • Python uses new lines to complete a command, as opposed to other programming languages which often use semicolons or parentheses. • Python relies on indentation, using whitespace, to define scope; such as the scope of loops, functions and classes. Other programming languages often use curly-brackets for this purpose. Prof. Percival A. Fernandez Python Syntax compared to other programming languages
  • 20. • The Python syntax defines a set of rules that are used to create Python statements while writing a Python Program. • The Python Programming Language Syntax has many similarities to Perl, C, and Java Programming Languages. However, there are some definite differences between the languages. • Python syntax can be executed by writing directly in the Command Line: Prof. Percival A. Fernandez Python - Basic Syntax
  • 21. • Or by creating a python file on the server, using the .py file extension, and running it in the Command Line: Prof. Percival A. Fernandez Python - Basic Syntax
  • 22. • Indentation refers to the spaces at the beginning of a code line. • Where in other programming languages the indentation in code is for readability only, the indentation in Python is very important. • Python uses indentation to indicate a block of code. • The number of spaces is up to you as a programmer, the most common use is four, but it has to be at least one. Prof. Percival A. Fernandez Python Indentation
  • 23. ❖Python - Interactive Mode Programming • We can invoke a Python interpreter from command line by typing python at the command prompt as following − • Here >>> denotes a Python Command Prompt where you can type your commands. Let's type the following text at the Python prompt and press the Enter − Prof. Percival A. Fernandez Example Python Program
  • 24. ❖Python - Script Mode Programming ▪ We can invoke the Python interpreter with a script parameter which begins the execution of the script and continues until the script is finished. When the script is finished, the interpreter is no longer active. ▪ Let us write a simple Python program in a script which is simple text file. Python files have extension .py. Type the following source code in a test.py file − • We assume that you have Python interpreter path set in PATH variable. Now, let's try to run this program as follows − Prof. Percival A. Fernandez Example Python Program
  • 25. • Comments can be used to explain Python code. • Comments can be used to make the code more readable. • Comments can be used to prevent execution when testing code. • Creating a Comment • Comments starts with a #, and Python will ignore them: • Comments can be placed at the end of a line, and Python will ignore the rest of the line: Prof. Percival A. Fernandez Python Comments
  • 26. • A Python identifier is a name used to identify a variable, function, class, module or other object. An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores and digits (0 to 9). • Python does not allow punctuation characters such as @, $, and % within identifiers. • Variables are containers for storing data values. • Creating Variables • Python has no command for declaring a variable. • A variable is created the moment you first assign a value to it. Prof. Percival A. Fernandez Python Identifiers
  • 27. • Casting • If you want to specify the data type of a variable, this can be done with casting. Prof. Percival A. Fernandez Python Identifiers
  • 28. • Single or Double Quotes? • String variables can be declared either by using single or double quotes: • Case-Sensitive • Variable names are case-sensitive. #A will not overwrite a Prof. Percival A. Fernandez Python Identifiers
  • 29. • Python programming provides no braces to indicate blocks of code for class and function definitions or flow control. Blocks of code are denoted by line indentation, which is rigidly enforced. • The number of spaces in the indentation is variable, but all statements within the block must be indented the same amount. For example − • However, the following block generates an error − Thus, in Python all the continuous lines indented with same number of spaces would form a block. Prof. Percival A. Fernandez Python Lines and Indentation
  • 30. • Python Data Types are used to define the type of a variable. It defines what type of data we are going to store in a variable. The data stored in memory can be of many types. • For example, a person's age is stored as a numeric value and his or her address is stored as alphanumeric characters. Prof. Percival A. Fernandez Python Data Types
  • 31. Prof. Percival A. Fernandez Python Data Types
  • 32. • Python numeric data types store numeric values. Number objects are created when you assign a value to them. For example − • Python supports four different numerical types − • int (signed integers) • long (long integers, they can also be represented in octal and hexadecimal) • float (floating point real values) • complex (complex numbers) Prof. Percival A. Fernandez Python Numeric Data Type
  • 33. • Python Strings are identified as a contiguous set of characters represented in the quotation marks. Python allows for either pairs of single or double quotes. • Subsets of strings can be taken using the slice operator ([ ] and [:] ) with indexes starting at 0 in the beginning of the string and working their way from -1 at the end. • The plus (+) sign is the string concatenation operator and the asterisk (*) is the repetition operator in Python. For example − Prof. Percival A. Fernandez Python String Data Type
  • 34. • Operators are used to perform operations on variables and values. • Python divides the operators in the following groups: • Arithmetic operators • Assignment operators • Comparison operators • Logical operators • Identity operators Prof. Percival A. Fernandez Python Operators • Membership operators • Bitwise operators
  • 35. • Python arithmetic operators are used to perform mathematical operations on numerical values. These operations are Addition, Subtraction, Multiplication, Division, Modulus, Exponents and Floor Division. This produce the following result − Prof. Percival A. Fernandez Python Arithmetic Operators
  • 36. • Python comparison operators compare the values on either sides of them and decide the relation among them. They are also called relational operators. These operators are equal, not equal, greater than, less than, greater than or equal to and less than or equal to. This produce the following result − Prof. Percival A. Fernandez Python Comparison Operators
  • 37. • Python assignment operators are used to assign values to variables. These operators include simple assignment operator, addition assign, subtraction assign, multiplication assign, division and assign operators etc. This produce the following result − Prof. Percival A. Fernandez Python Assignment Operators
  • 38. • https://www.python.org/about/gettingstarted/ • https://wiki.python.org/moin/BeginnersGuide/Download • https://www.tutorialspoint.com/python/python_environment.htm • https://www.w3schools.com/python/python_getstarted.asp • https://realpython.com/installing-python/ • https://www.python.org/about/gettingstarted/ • https://www.tutorialspoint.com/python/index.htm • https://www.geeksforgeeks.org/python-programming-language/ • https://www.w3schools.com/python/default.asp Prof. Percival A. Fernandez References: