SlideShare a Scribd company logo
1 of 14
Python Mini-Course
University of Oklahoma
Department of Psychology
Day 1 – Lesson 2
Fundamentals of Programming
Languages
4/5/09Python Mini-Course: Day 1 - Lesson 21
Lesson objectives
1. Describe the basic structure of the
Python language
2. Use the IDLE interactive
interpreter
3. Identify three kinds of errors that
occur in programming and
describe how to correct them
4/5/09Python Mini-Course: Day 1 - Lesson 22
Formal languages
Designed for specific apps
Ex: mathematical notation
Have strict rules for syntax
 3 + 3 = 6
 3+ = 3$6 (bad syntax)
Are literal and unambiguous
Structure is critical
4/5/09Python Mini-Course: Day 1 - Lesson 23
Programming languages
Formal languages that are
designed to express computations
and algorithms
Low level
One step removed from the 1’s and
0’s used by the computer
High level
More human-friendly languages
4/5/09Python Mini-Course: Day 1 - Lesson 24
Translating
High level language must be
translated into low level language
by either:
Interpreter (at run-time)
Compiler (creates a file containing
executable object code)
Python is an interpreted language
4/5/09Python Mini-Course: Day 1 - Lesson 25
Starting IDLE
4/5/09Python Mini-Course: Day 1 - Lesson 26
Programs
Programs are sequences of
instructions
Input
Output
Math and data manipulation
Conditional execution
Repetition
4/5/09Python Mini-Course: Day 1 - Lesson 27
The “Hello, World” program
4/5/09Python Mini-Course: Day 1 - Lesson 28
Scripts
A script is a file that contains a
program in a high-level
language for an interpreter
Python scripts are text files
ending in .py
Create HelloWorld.py
4/5/09Python Mini-Course: Day 1 - Lesson 29
Executing scripts
Python scripts are run in a
“shell”
This can be IDLE, a terminal shell
(OS X, Linux, Unix), or a
command prompt window (MS
Windows)
Run HelloWorld.py in IDLE
4/5/09Python Mini-Course: Day 1 - Lesson 210
Debugging
You will make mistakes while
programming!
These mistakes are called
“bugs” and the process of
tracking them down and
eliminating them is debugging
4/5/09Python Mini-Course: Day 1 - Lesson 211
Syntax Errors
All programming languages are
picky about syntax
Try this:
1 + 2) + 3
Syntax errors can be identified
using automated code checking
(color coding) and by error
messages
4/5/09Python Mini-Course: Day 1 - Lesson 212
Runtime errors
Errors that occur when
program is running
Also called “exceptions”
Ex: runtime.py
Identified by testing the
program (this includes using
test modules)
4/5/09Python Mini-Course: Day 1 - Lesson 213
Semantic or logical error
Program runs (and does
exactly what you told it to do)
But you made a mistake in the
design or implementation
Identified by case-based
testing
4/5/09Python Mini-Course: Day 1 - Lesson 214

More Related Content

What's hot

Before Starting Python Programming Language
Before Starting Python Programming LanguageBefore Starting Python Programming Language
Before Starting Python Programming LanguageKishan Tongrao
 
Subj specsoftware in language
Subj specsoftware in languageSubj specsoftware in language
Subj specsoftware in languagelittrpgaddict
 
Basic Programming Concept
Basic Programming ConceptBasic Programming Concept
Basic Programming ConceptCma Mohd
 
Introduction to Python Programming - I
Introduction to Python Programming  - IIntroduction to Python Programming  - I
Introduction to Python Programming - IArnab Chakraborty
 
Introduction to c_language
Introduction to c_languageIntroduction to c_language
Introduction to c_languageWay2itech
 
Programming languages and concepts by vivek parihar
Programming languages and concepts by vivek pariharProgramming languages and concepts by vivek parihar
Programming languages and concepts by vivek pariharVivek Parihar
 
Pf lec 01 intro
Pf lec 01 introPf lec 01 intro
Pf lec 01 introRajaKayani
 
Fundamental Programming Lect 1
Fundamental Programming Lect 1Fundamental Programming Lect 1
Fundamental Programming Lect 1Namrah Erum
 
Coding principles
Coding principles Coding principles
Coding principles DevAdnani
 
What is programming what are its benefits
What is programming  what are its benefits What is programming  what are its benefits
What is programming what are its benefits Vijay Singh Khatri
 
Algorithm pseudocode flowchart program notes
Algorithm pseudocode flowchart program notesAlgorithm pseudocode flowchart program notes
Algorithm pseudocode flowchart program notesArghodeepPaul
 
Principles of-programming-languages-lecture-notes-
Principles of-programming-languages-lecture-notes-Principles of-programming-languages-lecture-notes-
Principles of-programming-languages-lecture-notes-Krishna Sai
 
Programing language
Programing languagePrograming language
Programing languageJames Taylor
 
Programming language
Programming languageProgramming language
Programming languageDhani Ahmad
 
Programming Languages An Intro
Programming Languages An IntroProgramming Languages An Intro
Programming Languages An IntroKimberly De Guzman
 
Programming languages and paradigms
Programming languages and paradigmsProgramming languages and paradigms
Programming languages and paradigmsJohn Paul Hallasgo
 

What's hot (20)

Intermediate Languages
Intermediate LanguagesIntermediate Languages
Intermediate Languages
 
Before Starting Python Programming Language
Before Starting Python Programming LanguageBefore Starting Python Programming Language
Before Starting Python Programming Language
 
Subj specsoftware in language
Subj specsoftware in languageSubj specsoftware in language
Subj specsoftware in language
 
Basic Programming Concept
Basic Programming ConceptBasic Programming Concept
Basic Programming Concept
 
Introduction to c language
Introduction to c language Introduction to c language
Introduction to c language
 
Program Logic and Design
Program Logic and DesignProgram Logic and Design
Program Logic and Design
 
Introduction to Python Programming - I
Introduction to Python Programming  - IIntroduction to Python Programming  - I
Introduction to Python Programming - I
 
Introduction to c_language
Introduction to c_languageIntroduction to c_language
Introduction to c_language
 
Programming languages and concepts by vivek parihar
Programming languages and concepts by vivek pariharProgramming languages and concepts by vivek parihar
Programming languages and concepts by vivek parihar
 
Pf lec 01 intro
Pf lec 01 introPf lec 01 intro
Pf lec 01 intro
 
Fundamental Programming Lect 1
Fundamental Programming Lect 1Fundamental Programming Lect 1
Fundamental Programming Lect 1
 
Lecture # 1
Lecture # 1Lecture # 1
Lecture # 1
 
Coding principles
Coding principles Coding principles
Coding principles
 
What is programming what are its benefits
What is programming  what are its benefits What is programming  what are its benefits
What is programming what are its benefits
 
Algorithm pseudocode flowchart program notes
Algorithm pseudocode flowchart program notesAlgorithm pseudocode flowchart program notes
Algorithm pseudocode flowchart program notes
 
Principles of-programming-languages-lecture-notes-
Principles of-programming-languages-lecture-notes-Principles of-programming-languages-lecture-notes-
Principles of-programming-languages-lecture-notes-
 
Programing language
Programing languagePrograming language
Programing language
 
Programming language
Programming languageProgramming language
Programming language
 
Programming Languages An Intro
Programming Languages An IntroProgramming Languages An Intro
Programming Languages An Intro
 
Programming languages and paradigms
Programming languages and paradigmsProgramming languages and paradigms
Programming languages and paradigms
 

Similar to Python Mini-Course: Day 1 Fundamentals and Debugging

Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.Niraj Bharambe
 
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 TutorialQA TrainingHub
 
Python Programming for Beginners
Python Programming for BeginnersPython Programming for Beginners
Python Programming for BeginnersP. SUNDARI ARUN
 
Python Intro Slides for Students CSC-148 Chapter 1
Python Intro Slides for Students CSC-148  Chapter 1Python Intro Slides for Students CSC-148  Chapter 1
Python Intro Slides for Students CSC-148 Chapter 1Raza Ul Mustafa
 
Preliminary-Examination.docx
Preliminary-Examination.docxPreliminary-Examination.docx
Preliminary-Examination.docxStromilesVidal
 
Introduction to Python.pptx
Introduction to Python.pptxIntroduction to Python.pptx
Introduction to Python.pptxSamyakJain461
 
Introduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdfIntroduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdfVaibhavKumarSinghkal
 
Web Programming UNIT VIII notes
Web Programming UNIT VIII notesWeb Programming UNIT VIII notes
Web Programming UNIT VIII notesBhavsingh Maloth
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to pythonRanjith kumar
 
Computer Science 111 Computer Science I with Java and Pyth.docx
Computer Science 111 Computer Science I with Java and Pyth.docxComputer Science 111 Computer Science I with Java and Pyth.docx
Computer Science 111 Computer Science I with Java and Pyth.docxmccormicknadine86
 
Python quick guide1
Python quick guide1Python quick guide1
Python quick guide1Kanchilug
 
PYTHO programming NOTES with category.pdf
PYTHO programming NOTES with category.pdfPYTHO programming NOTES with category.pdf
PYTHO programming NOTES with category.pdfdeivasigamani9
 
PYTHON PROGRAMMING NOTES.pdf
PYTHON PROGRAMMING NOTES.pdfPYTHON PROGRAMMING NOTES.pdf
PYTHON PROGRAMMING NOTES.pdfRajathShetty34
 
1.Overview of Programming.pptx
1.Overview of Programming.pptx1.Overview of Programming.pptx
1.Overview of Programming.pptxVishwas459764
 
Python-00 | Introduction and installing
Python-00 | Introduction and installingPython-00 | Introduction and installing
Python-00 | Introduction and installingMohd Sajjad
 

Similar to Python Mini-Course: Day 1 Fundamentals and Debugging (20)

Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
 
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
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Python Programming for Beginners
Python Programming for BeginnersPython Programming for Beginners
Python Programming for Beginners
 
Summer Training Project.pdf
Summer Training Project.pdfSummer Training Project.pdf
Summer Training Project.pdf
 
Python Intro Slides for Students CSC-148 Chapter 1
Python Intro Slides for Students CSC-148  Chapter 1Python Intro Slides for Students CSC-148  Chapter 1
Python Intro Slides for Students CSC-148 Chapter 1
 
Preliminary-Examination.docx
Preliminary-Examination.docxPreliminary-Examination.docx
Preliminary-Examination.docx
 
Introduction to Python.pptx
Introduction to Python.pptxIntroduction to Python.pptx
Introduction to Python.pptx
 
Introduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdfIntroduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdf
 
Web Programming UNIT VIII notes
Web Programming UNIT VIII notesWeb Programming UNIT VIII notes
Web Programming UNIT VIII notes
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Computer Science 111 Computer Science I with Java and Pyth.docx
Computer Science 111 Computer Science I with Java and Pyth.docxComputer Science 111 Computer Science I with Java and Pyth.docx
Computer Science 111 Computer Science I with Java and Pyth.docx
 
Python quick guide1
Python quick guide1Python quick guide1
Python quick guide1
 
Hello World! with Python
Hello World! with PythonHello World! with Python
Hello World! with Python
 
MODULE 1.pptx
MODULE 1.pptxMODULE 1.pptx
MODULE 1.pptx
 
PYTHO programming NOTES with category.pdf
PYTHO programming NOTES with category.pdfPYTHO programming NOTES with category.pdf
PYTHO programming NOTES with category.pdf
 
PYTHON PROGRAMMING NOTES.pdf
PYTHON PROGRAMMING NOTES.pdfPYTHON PROGRAMMING NOTES.pdf
PYTHON PROGRAMMING NOTES.pdf
 
python unit2.pptx
python unit2.pptxpython unit2.pptx
python unit2.pptx
 
1.Overview of Programming.pptx
1.Overview of Programming.pptx1.Overview of Programming.pptx
1.Overview of Programming.pptx
 
Python-00 | Introduction and installing
Python-00 | Introduction and installingPython-00 | Introduction and installing
Python-00 | Introduction and installing
 

Python Mini-Course: Day 1 Fundamentals and Debugging

  • 1. Python Mini-Course University of Oklahoma Department of Psychology Day 1 – Lesson 2 Fundamentals of Programming Languages 4/5/09Python Mini-Course: Day 1 - Lesson 21
  • 2. Lesson objectives 1. Describe the basic structure of the Python language 2. Use the IDLE interactive interpreter 3. Identify three kinds of errors that occur in programming and describe how to correct them 4/5/09Python Mini-Course: Day 1 - Lesson 22
  • 3. Formal languages Designed for specific apps Ex: mathematical notation Have strict rules for syntax  3 + 3 = 6  3+ = 3$6 (bad syntax) Are literal and unambiguous Structure is critical 4/5/09Python Mini-Course: Day 1 - Lesson 23
  • 4. Programming languages Formal languages that are designed to express computations and algorithms Low level One step removed from the 1’s and 0’s used by the computer High level More human-friendly languages 4/5/09Python Mini-Course: Day 1 - Lesson 24
  • 5. Translating High level language must be translated into low level language by either: Interpreter (at run-time) Compiler (creates a file containing executable object code) Python is an interpreted language 4/5/09Python Mini-Course: Day 1 - Lesson 25
  • 7. Programs Programs are sequences of instructions Input Output Math and data manipulation Conditional execution Repetition 4/5/09Python Mini-Course: Day 1 - Lesson 27
  • 8. The “Hello, World” program 4/5/09Python Mini-Course: Day 1 - Lesson 28
  • 9. Scripts A script is a file that contains a program in a high-level language for an interpreter Python scripts are text files ending in .py Create HelloWorld.py 4/5/09Python Mini-Course: Day 1 - Lesson 29
  • 10. Executing scripts Python scripts are run in a “shell” This can be IDLE, a terminal shell (OS X, Linux, Unix), or a command prompt window (MS Windows) Run HelloWorld.py in IDLE 4/5/09Python Mini-Course: Day 1 - Lesson 210
  • 11. Debugging You will make mistakes while programming! These mistakes are called “bugs” and the process of tracking them down and eliminating them is debugging 4/5/09Python Mini-Course: Day 1 - Lesson 211
  • 12. Syntax Errors All programming languages are picky about syntax Try this: 1 + 2) + 3 Syntax errors can be identified using automated code checking (color coding) and by error messages 4/5/09Python Mini-Course: Day 1 - Lesson 212
  • 13. Runtime errors Errors that occur when program is running Also called “exceptions” Ex: runtime.py Identified by testing the program (this includes using test modules) 4/5/09Python Mini-Course: Day 1 - Lesson 213
  • 14. Semantic or logical error Program runs (and does exactly what you told it to do) But you made a mistake in the design or implementation Identified by case-based testing 4/5/09Python Mini-Course: Day 1 - Lesson 214