SlideShare a Scribd company logo
1 of 24
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
• Python is a simple, easy to learn, powerful, high
level and object-oriented programming language.
• Python is an interpreted scripting language also.
Guido Van Rossum is known as the founder of
python programming.
• Python is a general purpose, dynamic, high level and
interpreted programming language.
• It supports Object Oriented programming approach
to develop applications.
Introduction to Python:
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
…
• It is simple and easy to learn and provides lots of high-
level data structures.
• Python is easy to learn yet powerful and versatile
scripting language which makes it attractive for
Application Development. Python's syntax and dynamic
typing with its interpreted nature, makes it an ideal
language for scripting and rapid application
development.
• Python supports multiple programming pattern,
including object oriented, imperative and functional or
procedural programming styles.
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
• Python is not intended to work on special area such
as web programming. That is why it is known as
multipurpose because it can be used with web,
enterprise, 3D CAD etc.
• We don't need to use data types to declare variable
because it is dynamically typed so we can write
a=10 to assign an integer value in an integer
variable.
• Python makes the development and debugging fast
because there is no compilation step included in
python development and edit-test-debug cycle is
very fast.
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Python Features
• Easy to Learn and Use
• Python is easy to learn and use. It is developer-friendly and high
level programming language.
• Expressive Language
• Python language is more expressive means that it is more
understandable and readable.
• Interpreted Language
• Python is an interpreted language i.e. interpreter executes the code
line by line at a time. This makes debugging easy and thus suitable
for beginners.
• 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.
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
• Free and Open Source
• Python language is freely available at official web address. The
source-code is also available. Therefore it is open source.
• Object-Oriented Language
• Python supports object oriented language and concepts of classes
and objects come into existence.
• Extensible
• It implies that other languages such as C/C++ can be used to
compile the code and thus it can be used further in our python code.
• Large Standard Library
• Python has a large and broad library and provides rich set of module
and functions for rapid application development.
• GUI Programming Support
• Graphical user interfaces can be developed using Python.
• Integrated
• It can be easily integrated with languages like C, C++, JAVA etc.
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Python History
• Python laid its foundation in the late 1980s. The implementation of
Python was started in the December 1989 by Guido Van Rossum at
CWI (Centrum Wiskunde & Informatica) in Netherland.
• In February 1991, van Rossum published the code (labeled version
0.9.0) to alternate sources.
• In 1994, Python 1.0 was released with new features like: lambda,
map, filter, and reduce.
• Python 2.0 added new features like: list comprehensions, garbage
collection system.
• On December 3, 2008, Python 3.0 (also called "Py3K") was released.
It was designed to rectify fundamental flaw of the language.
• ABC programming language is said to be the predecessor of Python
language which was capable of Exception Handling and interfacing
with Amoeba Operating
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Python Version
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Python Application Area
• Web Applications
• Desktop GUI Applications
• Software Development
• Scientific and Numeric
• Business Applications
• Console Based Application
• Audio or Video based Applications
• 3D CAD Applications
• Enterprise Applications
• Applications for Images
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Python Keywords
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Input – Processing - Output
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Designing a Program
1. The first step in programming is designing –
flowcharts and pseudocode help with this
process.
2. Next, the code is written.
3. All code must be cleared of all syntax errors.
4. After the executable is created, it can be
checked for logic errors.
5. If logic errors exist, the program must be
debugged.
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
…
The purpose of Programming Logic and
Design is to focus on Flowcharts and
Pseudocode.
The design is the foundation of a good
program.
Figure 2-1 The program development cycle
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Two steps in designing a program
1. Understand the tasks that the program is to
perform.
• Learning what the customer wants.
2. Determine the steps that must be taken to
perform the task.
• Create an algorithm, or step-by-step directions to
solve the problem.
• Use flowcharts and/or pseudocode to solve.
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Pseudocode:
• Fake code used as a model for programs
• No syntax rules
• Well written pseudocode can be easily translated
to actual code
Display Hello World
Print(“Hello World!”)
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Flowcharts
• A diagram that graphically
depicts the steps that take
place in a program
Terminator used for
start and stop
Parallelogram used
for input and output
Rectangle used for
processes
Figure 2.2 Flowchart for the
pay calculating program
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Output, Input, and Variables
Output – data that is generated and displayed
Input – data that a program receives
Variables – storage locations in memory for data
Computer programs typically follow 3 steps
1. Input is received
2. Some process is performed on the input
3. Output is produced
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Variable Naming Convention
Programmers can define variable names following
certain rules
– Must be one word, no spaces
– Generally, punctuation characters are avoided
– Generally, the first character cannot be a number
– Name a variable something that indicates what may
be stored in it camel Case is popular naming
convention.
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Variable Assignment & Calculations
Calculations are performed using math operators
The expression is normally stored in variables
Set sale = price – discount
Table 2-1 Common math operators
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Variable Declarations & Data Types
A variable declaration includes a variable’s name
and a variable’s data type
Data Type – defines the type of data you intend to
store in a variable
– Integer – stores only whole numbers
– Real – stores whole or decimal numbers
– String – any series of characters
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-20
Documenting a Program
External documentation describes aspects of the
program for the user, sometimes written by a
technical writer
Internal documentation explains how parts of the
program works for the programmer, also
known as comments
// comments are often distinguished within
// the program with line comments
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Designing Your First Program
Calculate the batting average for any player
Batting Average = Hits ÷ Times at Bat
Determine what is required for each phase of the
program:
1.What must be read as input?
2.What will be done with the input?
3.What will be the output?
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Designing Your First Program
1. Input is received.
– The number of hits
– The number of times at bat
2. Some process is performed on the input.
– Calculate the batting average
– Divide the number of hits by the number of times at
bat
3. Output is produced.
– The player’s batting average
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Designing Your First Program
Figure 2-17 Flowchart for program 2-15
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Designing Your First Program
Summary
– Input
• Determine data needed for input
• Choose variables to store the input
– Process
• Determine calculations to be performed
• Choose variables to store the calculations
– Output
• Determine what output the program will display
• Usually the results of the program’s calculations

More Related Content

What's hot

Automatic subtitle generation
Automatic subtitle generationAutomatic subtitle generation
Automatic subtitle generation
tanyasaxena1611
 
Paper on Speech Recognition
Paper on Speech RecognitionPaper on Speech Recognition
Paper on Speech Recognition
Thejus Joby
 

What's hot (20)

Python lec 1002_for_biologists
Python lec 1002_for_biologistsPython lec 1002_for_biologists
Python lec 1002_for_biologists
 
Automatic subtitle generation
Automatic subtitle generationAutomatic subtitle generation
Automatic subtitle generation
 
Python lec 1001_for_biologists
Python lec 1001_for_biologistsPython lec 1001_for_biologists
Python lec 1001_for_biologists
 
Handson Python
Handson PythonHandson Python
Handson Python
 
IRJET- Python: Simple though an Important Programming Language
IRJET- Python: Simple though an Important Programming LanguageIRJET- Python: Simple though an Important Programming Language
IRJET- Python: Simple though an Important Programming Language
 
Python Training in Pune - Ethans Tech Pune
Python Training in Pune - Ethans Tech PunePython Training in Pune - Ethans Tech Pune
Python Training in Pune - Ethans Tech Pune
 
About Python Programming Language | Benefit of Python
About Python Programming Language | Benefit of PythonAbout Python Programming Language | Benefit of Python
About Python Programming Language | Benefit of Python
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Paper on Speech Recognition
Paper on Speech RecognitionPaper on Speech Recognition
Paper on Speech Recognition
 
5 Simple Steps To Install Python On Windows | Install Python 3.7 | Python Tra...
5 Simple Steps To Install Python On Windows | Install Python 3.7 | Python Tra...5 Simple Steps To Install Python On Windows | Install Python 3.7 | Python Tra...
5 Simple Steps To Install Python On Windows | Install Python 3.7 | Python Tra...
 
Learn Python Programming | Python Programming - Step by Step | Python for Beg...
Learn Python Programming | Python Programming - Step by Step | Python for Beg...Learn Python Programming | Python Programming - Step by Step | Python for Beg...
Learn Python Programming | Python Programming - Step by Step | Python for Beg...
 
Python for Big Data Analytics
Python for Big Data AnalyticsPython for Big Data Analytics
Python for Big Data Analytics
 
Text to-speech & voice recognition
Text to-speech & voice recognitionText to-speech & voice recognition
Text to-speech & voice recognition
 
Python
PythonPython
Python
 
Statistics Using Python | Statistics Python Tutorial | Python Certification T...
Statistics Using Python | Statistics Python Tutorial | Python Certification T...Statistics Using Python | Statistics Python Tutorial | Python Certification T...
Statistics Using Python | Statistics Python Tutorial | Python Certification T...
 
Machine learning session 1
Machine learning session 1Machine learning session 1
Machine learning session 1
 
Presentation on python
Presentation on pythonPresentation on python
Presentation on python
 
Python
PythonPython
Python
 
Lecture01 - Fundamental Programming with Python Language
Lecture01 - Fundamental Programming with Python LanguageLecture01 - Fundamental Programming with Python Language
Lecture01 - Fundamental Programming with Python Language
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 

Similar to Input, Processing and Output

Specification Of The Programming Language Of Java
Specification Of The Programming Language Of JavaSpecification Of The Programming Language Of Java
Specification Of The Programming Language Of Java
Kim Moore
 
Basic Python Introduction Lecture 1.pptx
Basic Python Introduction Lecture 1.pptxBasic Python Introduction Lecture 1.pptx
Basic Python Introduction Lecture 1.pptx
Aditya Patel
 
Python Intro For Managers
Python Intro For ManagersPython Intro For Managers
Python Intro For Managers
Atul Shridhar
 
Python Programming-1.pptx of python by computer
Python Programming-1.pptx of python by computerPython Programming-1.pptx of python by computer
Python Programming-1.pptx of python by computer
sharanyarashmir5
 
Annotated Bibliography On Unreliable Software
Annotated Bibliography On Unreliable SoftwareAnnotated Bibliography On Unreliable Software
Annotated Bibliography On Unreliable Software
Mary Brown
 

Similar to Input, Processing and Output (20)

Specification Of The Programming Language Of Java
Specification Of The Programming Language Of JavaSpecification Of The Programming Language Of Java
Specification Of The Programming Language Of Java
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python
 
An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()
 
A Research Study of Data Collection and Analysis of Semantics of Programming ...
A Research Study of Data Collection and Analysis of Semantics of Programming ...A Research Study of Data Collection and Analysis of Semantics of Programming ...
A Research Study of Data Collection and Analysis of Semantics of Programming ...
 
Lecture 1.pptx
Lecture 1.pptxLecture 1.pptx
Lecture 1.pptx
 
Training report 1923-b.e-eee-batchno--intern-54 (1).pdf
Training report 1923-b.e-eee-batchno--intern-54 (1).pdfTraining report 1923-b.e-eee-batchno--intern-54 (1).pdf
Training report 1923-b.e-eee-batchno--intern-54 (1).pdf
 
Basic Python Introduction Lecture 1.pptx
Basic Python Introduction Lecture 1.pptxBasic Python Introduction Lecture 1.pptx
Basic Python Introduction Lecture 1.pptx
 
High Level Language (HLL)
High Level Language (HLL)High Level Language (HLL)
High Level Language (HLL)
 
Is Python a Programming language or Scripting Language_.pdf
Is Python a Programming language or Scripting Language_.pdfIs Python a Programming language or Scripting Language_.pdf
Is Python a Programming language or Scripting Language_.pdf
 
Govind.ppt.pptx
Govind.ppt.pptxGovind.ppt.pptx
Govind.ppt.pptx
 
Is Python a Programming language or Scripting Language.pdf
Is Python a Programming language or Scripting Language.pdfIs Python a Programming language or Scripting Language.pdf
Is Python a Programming language or Scripting Language.pdf
 
POWER OF PYTHON PROGRAMMING LANGUAGE
POWER OF PYTHON PROGRAMMING LANGUAGE POWER OF PYTHON PROGRAMMING LANGUAGE
POWER OF PYTHON PROGRAMMING LANGUAGE
 
Why Python in required in Civil Engineering
Why Python in required in Civil EngineeringWhy Python in required in Civil Engineering
Why Python in required in Civil Engineering
 
Python Programming - I. Introduction
Python Programming - I. IntroductionPython Programming - I. Introduction
Python Programming - I. Introduction
 
Introduction To Python
Introduction To PythonIntroduction To Python
Introduction To Python
 
Python Intro For Managers
Python Intro For ManagersPython Intro For Managers
Python Intro For Managers
 
Python Programming-1.pptx of python by computer
Python Programming-1.pptx of python by computerPython Programming-1.pptx of python by computer
Python Programming-1.pptx of python by computer
 
Pyhton-1a-Basics.pdf
Pyhton-1a-Basics.pdfPyhton-1a-Basics.pdf
Pyhton-1a-Basics.pdf
 
INTRODUCTION-TO-PYTHON
INTRODUCTION-TO-PYTHONINTRODUCTION-TO-PYTHON
INTRODUCTION-TO-PYTHON
 
Annotated Bibliography On Unreliable Software
Annotated Bibliography On Unreliable SoftwareAnnotated Bibliography On Unreliable Software
Annotated Bibliography On Unreliable Software
 

More from Munazza-Mah-Jabeen

More from Munazza-Mah-Jabeen (20)

Virtual Functions
Virtual FunctionsVirtual Functions
Virtual Functions
 
The Standard Template Library
The Standard Template LibraryThe Standard Template Library
The Standard Template Library
 
Object-Oriented Software
Object-Oriented SoftwareObject-Oriented Software
Object-Oriented Software
 
Templates and Exceptions
 Templates and Exceptions Templates and Exceptions
Templates and Exceptions
 
Dictionaries and Sets
Dictionaries and SetsDictionaries and Sets
Dictionaries and Sets
 
More About Strings
More About StringsMore About Strings
More About Strings
 
Streams and Files
Streams and FilesStreams and Files
Streams and Files
 
Lists and Tuples
Lists and TuplesLists and Tuples
Lists and Tuples
 
Files and Exceptions
Files and ExceptionsFiles and Exceptions
Files and Exceptions
 
Functions
FunctionsFunctions
Functions
 
Pointers
PointersPointers
Pointers
 
Repitition Structure
Repitition StructureRepitition Structure
Repitition Structure
 
Inheritance
InheritanceInheritance
Inheritance
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator Overloading
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
Arrays and Strings
Arrays and StringsArrays and Strings
Arrays and Strings
 
Objects and Classes
Objects and ClassesObjects and Classes
Objects and Classes
 
Functions
FunctionsFunctions
Functions
 
Structures
StructuresStructures
Structures
 
Loops and Decisions
Loops and DecisionsLoops and Decisions
Loops and Decisions
 

Recently uploaded

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Recently uploaded (20)

Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answers
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 

Input, Processing and Output

  • 1. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley • Python is a simple, easy to learn, powerful, high level and object-oriented programming language. • Python is an interpreted scripting language also. Guido Van Rossum is known as the founder of python programming. • Python is a general purpose, dynamic, high level and interpreted programming language. • It supports Object Oriented programming approach to develop applications. Introduction to Python:
  • 2. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley … • It is simple and easy to learn and provides lots of high- level data structures. • Python is easy to learn yet powerful and versatile scripting language which makes it attractive for Application Development. Python's syntax and dynamic typing with its interpreted nature, makes it an ideal language for scripting and rapid application development. • Python supports multiple programming pattern, including object oriented, imperative and functional or procedural programming styles.
  • 3. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley • Python is not intended to work on special area such as web programming. That is why it is known as multipurpose because it can be used with web, enterprise, 3D CAD etc. • We don't need to use data types to declare variable because it is dynamically typed so we can write a=10 to assign an integer value in an integer variable. • Python makes the development and debugging fast because there is no compilation step included in python development and edit-test-debug cycle is very fast.
  • 4. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Python Features • Easy to Learn and Use • Python is easy to learn and use. It is developer-friendly and high level programming language. • Expressive Language • Python language is more expressive means that it is more understandable and readable. • Interpreted Language • Python is an interpreted language i.e. interpreter executes the code line by line at a time. This makes debugging easy and thus suitable for beginners. • 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.
  • 5. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley • Free and Open Source • Python language is freely available at official web address. The source-code is also available. Therefore it is open source. • Object-Oriented Language • Python supports object oriented language and concepts of classes and objects come into existence. • Extensible • It implies that other languages such as C/C++ can be used to compile the code and thus it can be used further in our python code. • Large Standard Library • Python has a large and broad library and provides rich set of module and functions for rapid application development. • GUI Programming Support • Graphical user interfaces can be developed using Python. • Integrated • It can be easily integrated with languages like C, C++, JAVA etc.
  • 6. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Python History • Python laid its foundation in the late 1980s. The implementation of Python was started in the December 1989 by Guido Van Rossum at CWI (Centrum Wiskunde & Informatica) in Netherland. • In February 1991, van Rossum published the code (labeled version 0.9.0) to alternate sources. • In 1994, Python 1.0 was released with new features like: lambda, map, filter, and reduce. • Python 2.0 added new features like: list comprehensions, garbage collection system. • On December 3, 2008, Python 3.0 (also called "Py3K") was released. It was designed to rectify fundamental flaw of the language. • ABC programming language is said to be the predecessor of Python language which was capable of Exception Handling and interfacing with Amoeba Operating
  • 7. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Python Version
  • 8. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Python Application Area • Web Applications • Desktop GUI Applications • Software Development • Scientific and Numeric • Business Applications • Console Based Application • Audio or Video based Applications • 3D CAD Applications • Enterprise Applications • Applications for Images
  • 9. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Python Keywords
  • 10. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Input – Processing - Output
  • 11. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Designing a Program 1. The first step in programming is designing – flowcharts and pseudocode help with this process. 2. Next, the code is written. 3. All code must be cleared of all syntax errors. 4. After the executable is created, it can be checked for logic errors. 5. If logic errors exist, the program must be debugged.
  • 12. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley … The purpose of Programming Logic and Design is to focus on Flowcharts and Pseudocode. The design is the foundation of a good program. Figure 2-1 The program development cycle
  • 13. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Two steps in designing a program 1. Understand the tasks that the program is to perform. • Learning what the customer wants. 2. Determine the steps that must be taken to perform the task. • Create an algorithm, or step-by-step directions to solve the problem. • Use flowcharts and/or pseudocode to solve.
  • 14. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Pseudocode: • Fake code used as a model for programs • No syntax rules • Well written pseudocode can be easily translated to actual code Display Hello World Print(“Hello World!”)
  • 15. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Flowcharts • A diagram that graphically depicts the steps that take place in a program Terminator used for start and stop Parallelogram used for input and output Rectangle used for processes Figure 2.2 Flowchart for the pay calculating program
  • 16. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Output, Input, and Variables Output – data that is generated and displayed Input – data that a program receives Variables – storage locations in memory for data Computer programs typically follow 3 steps 1. Input is received 2. Some process is performed on the input 3. Output is produced
  • 17. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Variable Naming Convention Programmers can define variable names following certain rules – Must be one word, no spaces – Generally, punctuation characters are avoided – Generally, the first character cannot be a number – Name a variable something that indicates what may be stored in it camel Case is popular naming convention.
  • 18. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Variable Assignment & Calculations Calculations are performed using math operators The expression is normally stored in variables Set sale = price – discount Table 2-1 Common math operators
  • 19. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Variable Declarations & Data Types A variable declaration includes a variable’s name and a variable’s data type Data Type – defines the type of data you intend to store in a variable – Integer – stores only whole numbers – Real – stores whole or decimal numbers – String – any series of characters
  • 20. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-20 Documenting a Program External documentation describes aspects of the program for the user, sometimes written by a technical writer Internal documentation explains how parts of the program works for the programmer, also known as comments // comments are often distinguished within // the program with line comments
  • 21. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Designing Your First Program Calculate the batting average for any player Batting Average = Hits ÷ Times at Bat Determine what is required for each phase of the program: 1.What must be read as input? 2.What will be done with the input? 3.What will be the output?
  • 22. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Designing Your First Program 1. Input is received. – The number of hits – The number of times at bat 2. Some process is performed on the input. – Calculate the batting average – Divide the number of hits by the number of times at bat 3. Output is produced. – The player’s batting average
  • 23. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Designing Your First Program Figure 2-17 Flowchart for program 2-15
  • 24. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Designing Your First Program Summary – Input • Determine data needed for input • Choose variables to store the input – Process • Determine calculations to be performed • Choose variables to store the calculations – Output • Determine what output the program will display • Usually the results of the program’s calculations