SlideShare a Scribd company logo
Introduction to Programming Language
(Python)
• Programming languages are essential tools used to
communicate instructions to computers.
• They bridge the gap between human-readable code
and machine-executable instructions.
Computer Languages
• Machine Language
• Uses binary code
• Machine-dependent
• Not portable
• Assembly Language
– Uses mnemonics
– Machine-dependent
– Not usually portable
• High-Level Language (HLL)
– Uses English-like language
– Machine independent
– Portable (but must be compiled for different platforms)
– Examples: Python, C, C++, Java, Fortran, . . .
Compilation
• Compiler translates source into target (a machine language
program)
• Compiler goes away at execution time
• Compiler is itself a machine language program
Compiler
Target Program
Source
Program
Target
Program
Input Output
Program Execution
• Steps taken by the CPU to run a program
(instructions are in machine language):
1. Fetch an instruction
2. Decode (interpret) the instruction
3. Retrieve data, if needed
4. Execute (perform) actual processing
5. Store the results, if needed
Write/Edit
Run
with some input
OK?
YES
More
Inputs?
YES
NO
NO
Program Cycle
Program Errors
• Syntax Errors:
– Errors in grammar of the language
• Runtime error:
– When there are no syntax errors, but the program can’t
complete execution
• Divide by zero
• Invalid input data
• Logical errors:
– The program completes execution, but delivers incorrect
results
– Incorrect usage of parentheses
How to use Python in your PC
• You can install the python software from
http://python.org/downloads/
• You can use the Python IDE (integrated development
environment) like PyCharm, Anaconda, Jupiter
notebook, etc.
• You can use online Python compiler like
www.onlinegdb.com
Ways to run the Python program
1. Running Python in interactive mode:
2. Running Python in script mode:
User Program
Filename as Hello with extension as py
• Working with the interactive mode is better when
Python programmers deal with small pieces of code
as you can type and execute them immediately, but
when the code is more than 2-4 lines, using the script
for coding can help to modify and use the code in
future
x,y = 6,10
if x < y:
print (x)
else:
print (y)
print (‘is the min’)
x y
6 10
Run the program
Output
6
Indentation
• Indentation is important in Python
– grouping of statement (block of statements)
– no explicit brackets, e.g. { }, to group statements
skipped
INPUT ( ) FUNCTION
INPUT ( ) FUNCTION
INPUT ( ) FUNCTION
INPUT ( ) FUNCTION
Input( ) Function is a built in function of
Input( ) Function is a built in function of
python used to read values from the user as a
python used to read values from the user as a
string type.
string type.
The general format or syntax of the input() is:
The general format or syntax of the input() is:
variableName =input(message)
variableName =input(message)
For Example:
For Example:
Where,
Where,
variableName
variableName is a variable which is the label
is a variable which is the label
for a memory location where the value is
for a memory location where the value is
stored.
stored.
INPUT ( ) FUNCTION
INPUT ( ) FUNCTION
For Example:
For Example:
p = input(“Enter the value”)
p = input(“Enter the value”)
Note: it will read the value as string (non-numeric).
Note: it will read the value as string (non-numeric).
x = int(input(“Enter x value”))
x = int(input(“Enter x value”))
reads the value and converts it in to integer type
reads the value and converts it in to integer type
data or value.
data or value.
y=float(input(“Enter y value”))
y=float(input(“Enter y value”))
reads the value and converts it in to float type
reads the value and converts it in to float type
data or value.
data or value.
INPUT ( ) FUNCTION
INPUT ( ) FUNCTION
int ( ) and float ( ) Functions:
int ( ) and float ( ) Functions:
Python offers two functions to be used
Python offers two functions to be used
with input( ) to convert the received values:
with input( ) to convert the received values:
Example 1:
Example 1: >>age = int(input(“Enter age”))
>>age = int(input(“Enter age”))
Example 2:
Example 2: >>sal=float(input(“Enter salary))
>>sal=float(input(“Enter salary))
PRINT ( ) FUNCTION
PRINT ( ) FUNCTION
PRINT ( ) FUNCTION
PRINT ( ) FUNCTION
print( )
print( ) Function is a built in function of
Function is a built in function of
python used to display the values on the
python used to display the values on the
screen
screen
The general format or syntax of the input() is:
The general format or syntax of the input() is:
Print(“message”, variable)
Print(“message”, variable)
The print function can print an arbitrary
The print function can print an arbitrary
number of values ("value1, value2, ..."), which are
number of values ("value1, value2, ..."), which are
separated by commas. These values are separated
separated by commas. These values are separated
by blanks. In the following example we can see
by blanks. In the following example we can see
two print calls. We are printing two values in both
two print calls. We are printing two values in both
cases, i.e. a string and a float number:
cases, i.e. a string and a float number:
PRINT ( ) FUNCTION
PRINT ( ) FUNCTION
print("Python is fun.")
print("Python is fun.")
a = 5
a = 5
#Two objects are passed:
#Two objects are passed:
print("a =", a)
print("a =", a)
b = a
b = a
# Three objects are passed:
# Three objects are passed:
print('a =', a, '= b‘)
print('a =', a, '= b‘)
Output
Output
Python is fun.
Python is fun.
a = 5
a = 5
a = 5 = b
a = 5 = b
Example 1: How print() works in Python?
Example 1: How print() works in Python?
PRINT ( ) FUNCTION
PRINT ( ) FUNCTION
>>> print("a = ", a)
>>> print("a = ", a)
a = 3.564
a = 3.564
>>> print("a = n", a)
>>> print("a = n", a)
a =
a =
3.564
3.564
>>>
>>>
Example 2: How print() works in Python?
Example 2: How print() works in Python?
Simple problems in Python:
• Print “Hello Word!”
• Add two integer numbers
• Multiplication of two numbers.
• Compute average of 3 numbers.
• Find area of rectangle.
• Find area of square
• Find area of circle
• Find perimeter of rectangle.
Any Questions Please
Any Questions Please

More Related Content

Similar to Python Programming Introduction demo.ppt (20)

PPTX
INTRODUCTION TO PYTHON.pptx
Nimrahafzal1
 
PDF
Introduction to phyton , important topic
akpgenious67
 
PPTX
Python for beginner, learn python from scratch.pptx
olieee2023
 
PDF
python-online&offline-training-in-kphb-hyderabad (1) (1).pdf
KosmikTech1
 
PPTX
Python knowledge ,......................
sabith777a
 
PDF
PYTHON PROGRAMMING NOTES RKREDDY.pdf
Ramakrishna Reddy Bijjam
 
PPTX
Introduction to learn and Python Interpreter
Alamelu
 
PPTX
Keep it Stupidly Simple Introduce Python
SushJalai
 
PDF
Python basics_ part1
Elaf A.Saeed
 
PPTX
IMP PPT- Python programming fundamentals.pptx
lemonchoos
 
PDF
Chapter 0 Python Overview (Python Programming Lecture)
IoT Code Lab
 
PPTX
Fundamentals of Python Programming
Kamal Acharya
 
PPTX
Python 01.pptx
AliMohammadAmiri
 
PPTX
Chapter7-Introduction to Python.pptx
lemonchoos
 
PPTX
#Code2Create: Python Basics
GDGKuwaitGoogleDevel
 
PDF
Python Data Types
athithanvijay
 
PPTX
Unit2 input output
deepak kumbhar
 
PPTX
Python programming workshop session 1
Abdul Haseeb
 
PDF
python.pdf
BurugollaRavi1
 
PPTX
introduction to python programming concepts
GautamDharamrajChouh
 
INTRODUCTION TO PYTHON.pptx
Nimrahafzal1
 
Introduction to phyton , important topic
akpgenious67
 
Python for beginner, learn python from scratch.pptx
olieee2023
 
python-online&offline-training-in-kphb-hyderabad (1) (1).pdf
KosmikTech1
 
Python knowledge ,......................
sabith777a
 
PYTHON PROGRAMMING NOTES RKREDDY.pdf
Ramakrishna Reddy Bijjam
 
Introduction to learn and Python Interpreter
Alamelu
 
Keep it Stupidly Simple Introduce Python
SushJalai
 
Python basics_ part1
Elaf A.Saeed
 
IMP PPT- Python programming fundamentals.pptx
lemonchoos
 
Chapter 0 Python Overview (Python Programming Lecture)
IoT Code Lab
 
Fundamentals of Python Programming
Kamal Acharya
 
Python 01.pptx
AliMohammadAmiri
 
Chapter7-Introduction to Python.pptx
lemonchoos
 
#Code2Create: Python Basics
GDGKuwaitGoogleDevel
 
Python Data Types
athithanvijay
 
Unit2 input output
deepak kumbhar
 
Python programming workshop session 1
Abdul Haseeb
 
python.pdf
BurugollaRavi1
 
introduction to python programming concepts
GautamDharamrajChouh
 

Recently uploaded (20)

PPTX
How to Add a Custom Button in Odoo 18 POS Screen
Celine George
 
PDF
Free eBook ~100 Common English Proverbs (ebook) pdf.pdf
OH TEIK BIN
 
PPTX
How to Setup Automatic Reordering Rule in Odoo 18 Inventory
Celine George
 
PPTX
How to Configure Taxes in Company Currency in Odoo 18 Accounting
Celine George
 
PDF
I3PM Case study smart parking 2025 with uptoIP® and ABP
MIPLM
 
PDF
TLE 8 QUARTER 1 MODULE WEEK 1 MATATAG CURRICULUM
denniseraya1997
 
PPTX
Parsing HTML read and write operations and OS Module.pptx
Ramakrishna Reddy Bijjam
 
PPTX
ENGLISH 8 REVISED K-12 CURRICULUM QUARTER 1 WEEK 1
LeomarrYsraelArzadon
 
PDF
Indian National movement PPT by Simanchala Sarab, Covering The INC(Formation,...
Simanchala Sarab, BABed(ITEP Secondary stage) in History student at GNDU Amritsar
 
PDF
Genomics Proteomics and Vaccines 1st Edition Guido Grandi (Editor)
kboqcyuw976
 
PPTX
How to Create & Manage Stages in Odoo 18 Helpdesk
Celine George
 
PPTX
Exploring Linear and Angular Quantities and Ergonomic Design.pptx
AngeliqueTolentinoDe
 
PDF
Wikinomics How Mass Collaboration Changes Everything Don Tapscott
wcsqyzf5909
 
PDF
Supply Chain Security A Comprehensive Approach 1st Edition Arthur G. Arway
rxgnika452
 
PPTX
Aerobic and Anaerobic respiration and CPR.pptx
Olivier Rochester
 
PPTX
Ward Management: Patient Care, Personnel, Equipment, and Environment.pptx
PRADEEP ABOTHU
 
PPTX
Building Powerful Agentic AI with Google ADK, MCP, RAG, and Ollama.pptx
Tamanna36
 
PPTX
Elo the Hero is an story about a young boy who became hero.
TeacherEmily1
 
PDF
TechSoup Microsoft Copilot Nonprofit Use Cases and Live Demo - 2025.06.25.pdf
TechSoup
 
PDF
The Power of Compound Interest (Stanford Initiative for Financial Decision-Ma...
Stanford IFDM
 
How to Add a Custom Button in Odoo 18 POS Screen
Celine George
 
Free eBook ~100 Common English Proverbs (ebook) pdf.pdf
OH TEIK BIN
 
How to Setup Automatic Reordering Rule in Odoo 18 Inventory
Celine George
 
How to Configure Taxes in Company Currency in Odoo 18 Accounting
Celine George
 
I3PM Case study smart parking 2025 with uptoIP® and ABP
MIPLM
 
TLE 8 QUARTER 1 MODULE WEEK 1 MATATAG CURRICULUM
denniseraya1997
 
Parsing HTML read and write operations and OS Module.pptx
Ramakrishna Reddy Bijjam
 
ENGLISH 8 REVISED K-12 CURRICULUM QUARTER 1 WEEK 1
LeomarrYsraelArzadon
 
Indian National movement PPT by Simanchala Sarab, Covering The INC(Formation,...
Simanchala Sarab, BABed(ITEP Secondary stage) in History student at GNDU Amritsar
 
Genomics Proteomics and Vaccines 1st Edition Guido Grandi (Editor)
kboqcyuw976
 
How to Create & Manage Stages in Odoo 18 Helpdesk
Celine George
 
Exploring Linear and Angular Quantities and Ergonomic Design.pptx
AngeliqueTolentinoDe
 
Wikinomics How Mass Collaboration Changes Everything Don Tapscott
wcsqyzf5909
 
Supply Chain Security A Comprehensive Approach 1st Edition Arthur G. Arway
rxgnika452
 
Aerobic and Anaerobic respiration and CPR.pptx
Olivier Rochester
 
Ward Management: Patient Care, Personnel, Equipment, and Environment.pptx
PRADEEP ABOTHU
 
Building Powerful Agentic AI with Google ADK, MCP, RAG, and Ollama.pptx
Tamanna36
 
Elo the Hero is an story about a young boy who became hero.
TeacherEmily1
 
TechSoup Microsoft Copilot Nonprofit Use Cases and Live Demo - 2025.06.25.pdf
TechSoup
 
The Power of Compound Interest (Stanford Initiative for Financial Decision-Ma...
Stanford IFDM
 
Ad

Python Programming Introduction demo.ppt

  • 1. Introduction to Programming Language (Python)
  • 2. • Programming languages are essential tools used to communicate instructions to computers. • They bridge the gap between human-readable code and machine-executable instructions.
  • 3. Computer Languages • Machine Language • Uses binary code • Machine-dependent • Not portable • Assembly Language – Uses mnemonics – Machine-dependent – Not usually portable • High-Level Language (HLL) – Uses English-like language – Machine independent – Portable (but must be compiled for different platforms) – Examples: Python, C, C++, Java, Fortran, . . .
  • 4. Compilation • Compiler translates source into target (a machine language program) • Compiler goes away at execution time • Compiler is itself a machine language program Compiler Target Program Source Program Target Program Input Output
  • 5. Program Execution • Steps taken by the CPU to run a program (instructions are in machine language): 1. Fetch an instruction 2. Decode (interpret) the instruction 3. Retrieve data, if needed 4. Execute (perform) actual processing 5. Store the results, if needed
  • 7. Program Errors • Syntax Errors: – Errors in grammar of the language • Runtime error: – When there are no syntax errors, but the program can’t complete execution • Divide by zero • Invalid input data • Logical errors: – The program completes execution, but delivers incorrect results – Incorrect usage of parentheses
  • 8. How to use Python in your PC • You can install the python software from http://python.org/downloads/ • You can use the Python IDE (integrated development environment) like PyCharm, Anaconda, Jupiter notebook, etc. • You can use online Python compiler like www.onlinegdb.com
  • 9. Ways to run the Python program 1. Running Python in interactive mode:
  • 10. 2. Running Python in script mode: User Program Filename as Hello with extension as py
  • 11. • Working with the interactive mode is better when Python programmers deal with small pieces of code as you can type and execute them immediately, but when the code is more than 2-4 lines, using the script for coding can help to modify and use the code in future
  • 12. x,y = 6,10 if x < y: print (x) else: print (y) print (‘is the min’) x y 6 10 Run the program Output 6 Indentation • Indentation is important in Python – grouping of statement (block of statements) – no explicit brackets, e.g. { }, to group statements skipped
  • 13. INPUT ( ) FUNCTION INPUT ( ) FUNCTION
  • 14. INPUT ( ) FUNCTION INPUT ( ) FUNCTION Input( ) Function is a built in function of Input( ) Function is a built in function of python used to read values from the user as a python used to read values from the user as a string type. string type. The general format or syntax of the input() is: The general format or syntax of the input() is: variableName =input(message) variableName =input(message) For Example: For Example: Where, Where, variableName variableName is a variable which is the label is a variable which is the label for a memory location where the value is for a memory location where the value is stored. stored.
  • 15. INPUT ( ) FUNCTION INPUT ( ) FUNCTION For Example: For Example: p = input(“Enter the value”) p = input(“Enter the value”) Note: it will read the value as string (non-numeric). Note: it will read the value as string (non-numeric). x = int(input(“Enter x value”)) x = int(input(“Enter x value”)) reads the value and converts it in to integer type reads the value and converts it in to integer type data or value. data or value. y=float(input(“Enter y value”)) y=float(input(“Enter y value”)) reads the value and converts it in to float type reads the value and converts it in to float type data or value. data or value.
  • 16. INPUT ( ) FUNCTION INPUT ( ) FUNCTION int ( ) and float ( ) Functions: int ( ) and float ( ) Functions: Python offers two functions to be used Python offers two functions to be used with input( ) to convert the received values: with input( ) to convert the received values: Example 1: Example 1: >>age = int(input(“Enter age”)) >>age = int(input(“Enter age”)) Example 2: Example 2: >>sal=float(input(“Enter salary)) >>sal=float(input(“Enter salary))
  • 17. PRINT ( ) FUNCTION PRINT ( ) FUNCTION
  • 18. PRINT ( ) FUNCTION PRINT ( ) FUNCTION print( ) print( ) Function is a built in function of Function is a built in function of python used to display the values on the python used to display the values on the screen screen The general format or syntax of the input() is: The general format or syntax of the input() is: Print(“message”, variable) Print(“message”, variable) The print function can print an arbitrary The print function can print an arbitrary number of values ("value1, value2, ..."), which are number of values ("value1, value2, ..."), which are separated by commas. These values are separated separated by commas. These values are separated by blanks. In the following example we can see by blanks. In the following example we can see two print calls. We are printing two values in both two print calls. We are printing two values in both cases, i.e. a string and a float number: cases, i.e. a string and a float number:
  • 19. PRINT ( ) FUNCTION PRINT ( ) FUNCTION print("Python is fun.") print("Python is fun.") a = 5 a = 5 #Two objects are passed: #Two objects are passed: print("a =", a) print("a =", a) b = a b = a # Three objects are passed: # Three objects are passed: print('a =', a, '= b‘) print('a =', a, '= b‘) Output Output Python is fun. Python is fun. a = 5 a = 5 a = 5 = b a = 5 = b Example 1: How print() works in Python? Example 1: How print() works in Python?
  • 20. PRINT ( ) FUNCTION PRINT ( ) FUNCTION >>> print("a = ", a) >>> print("a = ", a) a = 3.564 a = 3.564 >>> print("a = n", a) >>> print("a = n", a) a = a = 3.564 3.564 >>> >>> Example 2: How print() works in Python? Example 2: How print() works in Python?
  • 21. Simple problems in Python: • Print “Hello Word!” • Add two integer numbers • Multiplication of two numbers. • Compute average of 3 numbers. • Find area of rectangle. • Find area of square • Find area of circle • Find perimeter of rectangle.
  • 22. Any Questions Please Any Questions Please