SlideShare a Scribd company logo
BY
DR.BELMER GLADSON.V M.E.,Ph.D.,
ASSOCIATE PROFESSOR
ADHI COLLEGE OF ENGINEERING AND TECHNOLOGY
CONTENTS
 INTRODUCTION
 PROBLEM SOLVING TECHNIQUES
 ALGORITHMIC STRATEGIES
 FUNCTIONS
 PYTHON – VARIABLES AND OPERATORS
 CONTROL STRUCTURES
 STRINGS AND STRING MANIPULATION
 LIST,TUPLES AND DICTIONARY
INTRODUCTION
 Python is a general-purpose interpreted, interactive,
object-oriented, and high-level programming
language.
 It was created by Guido van Rossum during 1985- 1990
Why to Learn Python?
 Python is a high-level, interpreted, interactive and
object-oriented scripting language.
 Designed- highly readable.
 Uses English Keywords frequently.
 To become a great Software Engineer – Web
Development Domain.
 Python is Interpreted
 Python is Interactive
 Python is Object-Oriented
 Python is a Beginner's Language
Applications of Python
 Easy-to-learn
 Easy-to-read
 Easy-to-maintain
 Interactive Mode
 Portable
 OpenSource
 Real Time Applications
 Bit Torrent file sharing
 Google search engine, YouTube
 Face book, Drop box
PROBLEM SOLVING TECHNIQUES
 Define the problem and creating number of solutions.
 Starts –Problem specification, Ends – Correct
Program.
PROBLEM SOLVING TECHNIQUES
• Set of techniques that helps in providing logic –solve
the problem.
1. Algorithms.
2. Flowcharts.
3. Pseudo codes.
4. Programs
ALGORITHM
 Sequence of instructions that describe a method.
Qualities of an Algorithm:
 Should be written in simple English
 Should be precise and unambiguous.
 Should not be repeated infinitely.
 should conclude after a finite number of steps.
 Should have an end point
 Derived results should be obtained only after the
algorithm terminates.
Example:
Addition of Two Numbers:
1.Start
2. Read the value of ‘a’
3. Read the value of ‘b’
4. Calculate sum=a+b
5. Print the sum of two number
6. Stop
Flowchart
---Graphical Representation of an Algorithm
Example:
Pseudocode
 Informal high-level description.
 Example:
 To find sum of two numbers
1.READ num1,num2
2.sum=num1+num2
3.PRINT sum
Program
 Program= Algorithm +Data
 Set of instruction, to the computer to solve a problem.
 Accept the data to perform computation.
ALGORITHMIC STRATEGIES
FUNCTIONS
 Block of organized, reusable code that is used to
perform a single, related action.
 Methods, sub-routines.
 Syntax
function_name(parameters)
function statements
end function
Algorithm for addition of two
numbers using function
 Main function()
Step 1: Start
Step 2:Call the function add()
Step 3: Stop
• Sub function add()
Step1:Functionstart
Step2:Geta,bValues
Step 3: add c=a+b
Step 4: Print c
Step 5: Return
VARIABLES:
 Store a value by assigning it to a name.
 It can be of any length. No space is allowed
 Assigning value to variable:
 >>>counter =45
print (counter)
 single value to several variables
a=b=c=100
 Multiple values to multiple variables
>>>a,b,c=2,4,"ram"
OPERATORS
 Constructs which can manipulate the value of operands.
expression 4 + 5 = 9
 Types of Operators
 Arithmetic Operators
 Comparison (Relational)Operators
 Assignment Operators
 Logical Operators
 Bitwise Operators
 Membership Operators
 Identity Operators
Arithmetic operators:
Comparison (Relational)Operators
Assignment Operators
Logical Operators:
Bitwise Operators:
Membership Operators:
CONTROL STRUCTURES
 Conditional Statements
Conditional if
Alternative if… else
Chained if…elif…else
Nested if….else
Conditional if
Alternative if… else
Chained if…elif…else
Example
Nested if….else
Example:
STRINGS AND STRING MANIPULATION
 Series or sequence of characters
 Strings are marked by quotes:
Single quotes(' ') E.g., 'This a string in single quotes'
Double quotes(" ") E.g., "'This a string in double quotes‘”
Triple quotes(""" """)E.g., """This is a paragraph. It is
made up of multiple lines and sentences.""“
 Strings are Immutable
Operations on string
Lists
 List is an ordered sequence of items
 square brackets[]
 Items in the lists can be of different datatypes
 Operations on list: Indexing, Slicing ,Concatenation
Repetitions, Updation, Insertion, Deletion
Operations on list
Tuple:
 A tuple is same as list
 Parentheses()
 A tuple is an immutable list
 Benefit of Tuple:
 Tuples are faster than lists.
 If the user wants to protect the data from accidental changes,
tuple can be used
Basic Operations:
Dictionaries
 Dictionaries are unorderedsets.
 curly brackets{}
 Dictionaries are accessed via keys
Operations:
PROBLEM SOLVING TECHNIQUES USING PYTHON.pptx
Ad

More Related Content

What's hot (20)

Primitive data types
Primitive data typesPrimitive data types
Primitive data types
Student
 
Python | What is Python | History of Python | Python Tutorial
Python | What is Python | History of Python | Python TutorialPython | What is Python | History of Python | Python Tutorial
Python | What is Python | History of Python | Python Tutorial
QA TrainingHub
 
Parallel projection
Parallel projectionParallel projection
Parallel projection
Prince Shahu
 
Expression and Operartor In C Programming
Expression and Operartor In C Programming Expression and Operartor In C Programming
Expression and Operartor In C Programming
Kamal Acharya
 
Python ppt
Python pptPython ppt
Python ppt
Rohit Verma
 
Pointer in c
Pointer in cPointer in c
Pointer in c
lavanya marichamy
 
Python introduction
Python introductionPython introduction
Python introduction
Jignesh Kariya
 
1. over view and history of c
1. over view and history of c1. over view and history of c
1. over view and history of c
Harish Kumawat
 
Computer graphics - colour crt and flat-panel displays
Computer graphics - colour crt and flat-panel displaysComputer graphics - colour crt and flat-panel displays
Computer graphics - colour crt and flat-panel displays
Vishnupriya T H
 
functions of C++
functions of C++functions of C++
functions of C++
tarandeep_kaur
 
Computer graphics basic transformation
Computer graphics basic transformationComputer graphics basic transformation
Computer graphics basic transformation
Selvakumar Gna
 
Functions in C
Functions in CFunctions in C
Functions in C
Kamal Acharya
 
C++ programming
C++ programmingC++ programming
C++ programming
Emertxe Information Technologies Pvt Ltd
 
Pointers in C Programming
Pointers in C ProgrammingPointers in C Programming
Pointers in C Programming
Jasleen Kaur (Chandigarh University)
 
Presentation on C programming language
Presentation on C programming languagePresentation on C programming language
Presentation on C programming language
Ashmita Tuition Center
 
Python final ppt
Python final pptPython final ppt
Python final ppt
Ripal Ranpara
 
Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
Prof. Dr. K. Adisesha
 
Introduction to C++
Introduction to C++Introduction to C++
Introduction to C++
Sikder Tahsin Al-Amin
 
Spline representations
Spline representationsSpline representations
Spline representations
Nikhil krishnan
 
Raster scan system & random scan system
Raster scan system & random scan systemRaster scan system & random scan system
Raster scan system & random scan system
shalinikarunakaran1
 

Similar to PROBLEM SOLVING TECHNIQUES USING PYTHON.pptx (20)

Intro-to-Python-Part-1-first-part-edition.pdf
Intro-to-Python-Part-1-first-part-edition.pdfIntro-to-Python-Part-1-first-part-edition.pdf
Intro-to-Python-Part-1-first-part-edition.pdf
ssuser543728
 
Python Programming - II. The Basics
Python Programming - II. The BasicsPython Programming - II. The Basics
Python Programming - II. The Basics
Ranel Padon
 
Python
PythonPython
Python
Aashish Jain
 
program fundamentals using python1 2 3 4.pptx
program fundamentals using python1 2 3 4.pptxprogram fundamentals using python1 2 3 4.pptx
program fundamentals using python1 2 3 4.pptx
ibrahimsoryjalloh91
 
Automation Testing theory notes.pptx
Automation Testing theory notes.pptxAutomation Testing theory notes.pptx
Automation Testing theory notes.pptx
NileshBorkar12
 
Introduction of Python
Introduction of PythonIntroduction of Python
Introduction of Python
ZENUS INFOTECH INDIA PVT. LTD.
 
An Overview Of Python With Functional Programming
An Overview Of Python With Functional ProgrammingAn Overview Of Python With Functional Programming
An Overview Of Python With Functional Programming
Adam Getchell
 
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org) (usef...
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org)  (usef...Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org)  (usef...
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org) (usef...
Make Mannan
 
3-Python Python oho pytho hdiwefjhdsjhds
3-Python Python oho pytho hdiwefjhdsjhds3-Python Python oho pytho hdiwefjhdsjhds
3-Python Python oho pytho hdiwefjhdsjhds
hardikbhagwaria83
 
Python_Haegl.powerpoint presentation. tx
Python_Haegl.powerpoint presentation. txPython_Haegl.powerpoint presentation. tx
Python_Haegl.powerpoint presentation. tx
vishwanathgoudapatil1
 
Introduction-to-Python-Programming1.pptx
Introduction-to-Python-Programming1.pptxIntroduction-to-Python-Programming1.pptx
Introduction-to-Python-Programming1.pptx
vijayalakshmi257551
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Ranjith kumar
 
C++ book
C++ bookC++ book
C++ book
mailmerk
 
Welcome to python workshop
Welcome to python workshopWelcome to python workshop
Welcome to python workshop
Mukul Kirti Verma
 
Introduction-to-Python.pptx grade 9 ICT.
Introduction-to-Python.pptx grade 9 ICT.Introduction-to-Python.pptx grade 9 ICT.
Introduction-to-Python.pptx grade 9 ICT.
NeilIvanCasas1
 
MODULE 1.pptx
MODULE 1.pptxMODULE 1.pptx
MODULE 1.pptx
KPDDRAVIDIAN
 
Pyhton-1a-Basics.pdf
Pyhton-1a-Basics.pdfPyhton-1a-Basics.pdf
Pyhton-1a-Basics.pdf
Mattupallipardhu
 
object oriented programming language in c++
object oriented programming language in c++object oriented programming language in c++
object oriented programming language in c++
Ravikant517175
 
Data Structure and Algorithms (DSA) with Python
Data Structure and Algorithms (DSA) with PythonData Structure and Algorithms (DSA) with Python
Data Structure and Algorithms (DSA) with Python
epsilonice
 
Intro-to-Python-Part-1-first-part-edition.pdf
Intro-to-Python-Part-1-first-part-edition.pdfIntro-to-Python-Part-1-first-part-edition.pdf
Intro-to-Python-Part-1-first-part-edition.pdf
ssuser543728
 
Python Programming - II. The Basics
Python Programming - II. The BasicsPython Programming - II. The Basics
Python Programming - II. The Basics
Ranel Padon
 
program fundamentals using python1 2 3 4.pptx
program fundamentals using python1 2 3 4.pptxprogram fundamentals using python1 2 3 4.pptx
program fundamentals using python1 2 3 4.pptx
ibrahimsoryjalloh91
 
Automation Testing theory notes.pptx
Automation Testing theory notes.pptxAutomation Testing theory notes.pptx
Automation Testing theory notes.pptx
NileshBorkar12
 
An Overview Of Python With Functional Programming
An Overview Of Python With Functional ProgrammingAn Overview Of Python With Functional Programming
An Overview Of Python With Functional Programming
Adam Getchell
 
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org) (usef...
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org)  (usef...Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org)  (usef...
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org) (usef...
Make Mannan
 
3-Python Python oho pytho hdiwefjhdsjhds
3-Python Python oho pytho hdiwefjhdsjhds3-Python Python oho pytho hdiwefjhdsjhds
3-Python Python oho pytho hdiwefjhdsjhds
hardikbhagwaria83
 
Python_Haegl.powerpoint presentation. tx
Python_Haegl.powerpoint presentation. txPython_Haegl.powerpoint presentation. tx
Python_Haegl.powerpoint presentation. tx
vishwanathgoudapatil1
 
Introduction-to-Python-Programming1.pptx
Introduction-to-Python-Programming1.pptxIntroduction-to-Python-Programming1.pptx
Introduction-to-Python-Programming1.pptx
vijayalakshmi257551
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Ranjith kumar
 
Introduction-to-Python.pptx grade 9 ICT.
Introduction-to-Python.pptx grade 9 ICT.Introduction-to-Python.pptx grade 9 ICT.
Introduction-to-Python.pptx grade 9 ICT.
NeilIvanCasas1
 
object oriented programming language in c++
object oriented programming language in c++object oriented programming language in c++
object oriented programming language in c++
Ravikant517175
 
Data Structure and Algorithms (DSA) with Python
Data Structure and Algorithms (DSA) with PythonData Structure and Algorithms (DSA) with Python
Data Structure and Algorithms (DSA) with Python
epsilonice
 
Ad

Recently uploaded (20)

RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdfRICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
MohamedAbdelkader115
 
Routing Riverdale - A New Bus Connection
Routing Riverdale - A New Bus ConnectionRouting Riverdale - A New Bus Connection
Routing Riverdale - A New Bus Connection
jzb7232
 
Artificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptxArtificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptx
rakshanatarajan005
 
Compiler Design_Code Optimization tech.pptx
Compiler Design_Code Optimization tech.pptxCompiler Design_Code Optimization tech.pptx
Compiler Design_Code Optimization tech.pptx
RushaliDeshmukh2
 
Computer Security Fundamentals Chapter 1
Computer Security Fundamentals Chapter 1Computer Security Fundamentals Chapter 1
Computer Security Fundamentals Chapter 1
remoteaimms
 
Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...
Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...
Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...
Journal of Soft Computing in Civil Engineering
 
COMPUTER GRAPHICS AND VISUALIZATION :MODULE-02 notes [BCG402-CG&V].pdf
COMPUTER GRAPHICS AND VISUALIZATION :MODULE-02 notes [BCG402-CG&V].pdfCOMPUTER GRAPHICS AND VISUALIZATION :MODULE-02 notes [BCG402-CG&V].pdf
COMPUTER GRAPHICS AND VISUALIZATION :MODULE-02 notes [BCG402-CG&V].pdf
Alvas Institute of Engineering and technology, Moodabidri
 
Nanometer Metal-Organic-Framework Literature Comparison
Nanometer Metal-Organic-Framework  Literature ComparisonNanometer Metal-Organic-Framework  Literature Comparison
Nanometer Metal-Organic-Framework Literature Comparison
Chris Harding
 
NOMA analysis in 5G communication systems
NOMA analysis in 5G communication systemsNOMA analysis in 5G communication systems
NOMA analysis in 5G communication systems
waleedali330654
 
ZJIT: Building a Next Generation Ruby JIT
ZJIT: Building a Next Generation Ruby JITZJIT: Building a Next Generation Ruby JIT
ZJIT: Building a Next Generation Ruby JIT
maximechevalierboisv1
 
COMPUTER GRAPHICS AND VISUALIZATION :MODULE-1 notes [BCG402-CG&V].pdf
COMPUTER GRAPHICS AND VISUALIZATION :MODULE-1 notes [BCG402-CG&V].pdfCOMPUTER GRAPHICS AND VISUALIZATION :MODULE-1 notes [BCG402-CG&V].pdf
COMPUTER GRAPHICS AND VISUALIZATION :MODULE-1 notes [BCG402-CG&V].pdf
Alvas Institute of Engineering and technology, Moodabidri
 
Introduction to FLUID MECHANICS & KINEMATICS
Introduction to FLUID MECHANICS &  KINEMATICSIntroduction to FLUID MECHANICS &  KINEMATICS
Introduction to FLUID MECHANICS & KINEMATICS
narayanaswamygdas
 
Machine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATIONMachine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATION
DarrinBright1
 
Compiler Design_Intermediate code generation new ppt.pptx
Compiler Design_Intermediate code generation new ppt.pptxCompiler Design_Intermediate code generation new ppt.pptx
Compiler Design_Intermediate code generation new ppt.pptx
RushaliDeshmukh2
 
The Gaussian Process Modeling Module in UQLab
The Gaussian Process Modeling Module in UQLabThe Gaussian Process Modeling Module in UQLab
The Gaussian Process Modeling Module in UQLab
Journal of Soft Computing in Civil Engineering
 
Surveying through global positioning system
Surveying through global positioning systemSurveying through global positioning system
Surveying through global positioning system
opneptune5
 
W1 WDM_Principle and basics to know.pptx
W1 WDM_Principle and basics to know.pptxW1 WDM_Principle and basics to know.pptx
W1 WDM_Principle and basics to know.pptx
muhhxx51
 
How to Buy Snapchat Account A Step-by-Step Guide.pdf
How to Buy Snapchat Account A Step-by-Step Guide.pdfHow to Buy Snapchat Account A Step-by-Step Guide.pdf
How to Buy Snapchat Account A Step-by-Step Guide.pdf
jamedlimmk
 
SICPA: Fabien Keller - background introduction
SICPA: Fabien Keller - background introductionSICPA: Fabien Keller - background introduction
SICPA: Fabien Keller - background introduction
fabienklr
 
twin tower attack 2001 new york city
twin  tower  attack  2001 new  york citytwin  tower  attack  2001 new  york city
twin tower attack 2001 new york city
harishreemavs
 
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdfRICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
MohamedAbdelkader115
 
Routing Riverdale - A New Bus Connection
Routing Riverdale - A New Bus ConnectionRouting Riverdale - A New Bus Connection
Routing Riverdale - A New Bus Connection
jzb7232
 
Artificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptxArtificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptx
rakshanatarajan005
 
Compiler Design_Code Optimization tech.pptx
Compiler Design_Code Optimization tech.pptxCompiler Design_Code Optimization tech.pptx
Compiler Design_Code Optimization tech.pptx
RushaliDeshmukh2
 
Computer Security Fundamentals Chapter 1
Computer Security Fundamentals Chapter 1Computer Security Fundamentals Chapter 1
Computer Security Fundamentals Chapter 1
remoteaimms
 
Nanometer Metal-Organic-Framework Literature Comparison
Nanometer Metal-Organic-Framework  Literature ComparisonNanometer Metal-Organic-Framework  Literature Comparison
Nanometer Metal-Organic-Framework Literature Comparison
Chris Harding
 
NOMA analysis in 5G communication systems
NOMA analysis in 5G communication systemsNOMA analysis in 5G communication systems
NOMA analysis in 5G communication systems
waleedali330654
 
ZJIT: Building a Next Generation Ruby JIT
ZJIT: Building a Next Generation Ruby JITZJIT: Building a Next Generation Ruby JIT
ZJIT: Building a Next Generation Ruby JIT
maximechevalierboisv1
 
Introduction to FLUID MECHANICS & KINEMATICS
Introduction to FLUID MECHANICS &  KINEMATICSIntroduction to FLUID MECHANICS &  KINEMATICS
Introduction to FLUID MECHANICS & KINEMATICS
narayanaswamygdas
 
Machine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATIONMachine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATION
DarrinBright1
 
Compiler Design_Intermediate code generation new ppt.pptx
Compiler Design_Intermediate code generation new ppt.pptxCompiler Design_Intermediate code generation new ppt.pptx
Compiler Design_Intermediate code generation new ppt.pptx
RushaliDeshmukh2
 
Surveying through global positioning system
Surveying through global positioning systemSurveying through global positioning system
Surveying through global positioning system
opneptune5
 
W1 WDM_Principle and basics to know.pptx
W1 WDM_Principle and basics to know.pptxW1 WDM_Principle and basics to know.pptx
W1 WDM_Principle and basics to know.pptx
muhhxx51
 
How to Buy Snapchat Account A Step-by-Step Guide.pdf
How to Buy Snapchat Account A Step-by-Step Guide.pdfHow to Buy Snapchat Account A Step-by-Step Guide.pdf
How to Buy Snapchat Account A Step-by-Step Guide.pdf
jamedlimmk
 
SICPA: Fabien Keller - background introduction
SICPA: Fabien Keller - background introductionSICPA: Fabien Keller - background introduction
SICPA: Fabien Keller - background introduction
fabienklr
 
twin tower attack 2001 new york city
twin  tower  attack  2001 new  york citytwin  tower  attack  2001 new  york city
twin tower attack 2001 new york city
harishreemavs
 
Ad

PROBLEM SOLVING TECHNIQUES USING PYTHON.pptx

  • 1. BY DR.BELMER GLADSON.V M.E.,Ph.D., ASSOCIATE PROFESSOR ADHI COLLEGE OF ENGINEERING AND TECHNOLOGY
  • 2. CONTENTS  INTRODUCTION  PROBLEM SOLVING TECHNIQUES  ALGORITHMIC STRATEGIES  FUNCTIONS  PYTHON – VARIABLES AND OPERATORS  CONTROL STRUCTURES  STRINGS AND STRING MANIPULATION  LIST,TUPLES AND DICTIONARY
  • 3. INTRODUCTION  Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language.  It was created by Guido van Rossum during 1985- 1990
  • 4. Why to Learn Python?  Python is a high-level, interpreted, interactive and object-oriented scripting language.  Designed- highly readable.  Uses English Keywords frequently.  To become a great Software Engineer – Web Development Domain.  Python is Interpreted  Python is Interactive  Python is Object-Oriented  Python is a Beginner's Language
  • 5. Applications of Python  Easy-to-learn  Easy-to-read  Easy-to-maintain  Interactive Mode  Portable  OpenSource  Real Time Applications  Bit Torrent file sharing  Google search engine, YouTube  Face book, Drop box
  • 6. PROBLEM SOLVING TECHNIQUES  Define the problem and creating number of solutions.  Starts –Problem specification, Ends – Correct Program. PROBLEM SOLVING TECHNIQUES • Set of techniques that helps in providing logic –solve the problem. 1. Algorithms. 2. Flowcharts. 3. Pseudo codes. 4. Programs
  • 7. ALGORITHM  Sequence of instructions that describe a method. Qualities of an Algorithm:  Should be written in simple English  Should be precise and unambiguous.  Should not be repeated infinitely.  should conclude after a finite number of steps.  Should have an end point  Derived results should be obtained only after the algorithm terminates.
  • 8. Example: Addition of Two Numbers: 1.Start 2. Read the value of ‘a’ 3. Read the value of ‘b’ 4. Calculate sum=a+b 5. Print the sum of two number 6. Stop
  • 11. Pseudocode  Informal high-level description.  Example:  To find sum of two numbers 1.READ num1,num2 2.sum=num1+num2 3.PRINT sum
  • 12. Program  Program= Algorithm +Data  Set of instruction, to the computer to solve a problem.  Accept the data to perform computation.
  • 14. FUNCTIONS  Block of organized, reusable code that is used to perform a single, related action.  Methods, sub-routines.  Syntax function_name(parameters) function statements end function
  • 15. Algorithm for addition of two numbers using function  Main function() Step 1: Start Step 2:Call the function add() Step 3: Stop • Sub function add() Step1:Functionstart Step2:Geta,bValues Step 3: add c=a+b Step 4: Print c Step 5: Return
  • 16. VARIABLES:  Store a value by assigning it to a name.  It can be of any length. No space is allowed  Assigning value to variable:  >>>counter =45 print (counter)  single value to several variables a=b=c=100  Multiple values to multiple variables >>>a,b,c=2,4,"ram"
  • 17. OPERATORS  Constructs which can manipulate the value of operands. expression 4 + 5 = 9  Types of Operators  Arithmetic Operators  Comparison (Relational)Operators  Assignment Operators  Logical Operators  Bitwise Operators  Membership Operators  Identity Operators
  • 24. CONTROL STRUCTURES  Conditional Statements Conditional if Alternative if… else Chained if…elif…else Nested if….else
  • 31. STRINGS AND STRING MANIPULATION  Series or sequence of characters  Strings are marked by quotes: Single quotes(' ') E.g., 'This a string in single quotes' Double quotes(" ") E.g., "'This a string in double quotes‘” Triple quotes(""" """)E.g., """This is a paragraph. It is made up of multiple lines and sentences.""“  Strings are Immutable
  • 33. Lists  List is an ordered sequence of items  square brackets[]  Items in the lists can be of different datatypes  Operations on list: Indexing, Slicing ,Concatenation Repetitions, Updation, Insertion, Deletion
  • 35. Tuple:  A tuple is same as list  Parentheses()  A tuple is an immutable list  Benefit of Tuple:  Tuples are faster than lists.  If the user wants to protect the data from accidental changes, tuple can be used
  • 37. Dictionaries  Dictionaries are unorderedsets.  curly brackets{}  Dictionaries are accessed via keys