SlideShare a Scribd company logo
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

PPTX
Cmp2412 programming principles
PPTX
introduction to programming
PPTX
Computer
PDF
notes on Programming fundamentals
PPTX
An introduction-to-programming
PDF
Introduction to Computer Programming
PPT
Programing Language
PPT
13 A Programing Languages (IT) Lecture Slide
Cmp2412 programming principles
introduction to programming
Computer
notes on Programming fundamentals
An introduction-to-programming
Introduction to Computer Programming
Programing Language
13 A Programing Languages (IT) Lecture Slide

What's hot (20)

PDF
Intermediate Languages
PPTX
Before Starting Python Programming Language
ODP
Subj specsoftware in language
PPT
Basic Programming Concept
PPTX
Introduction to c language
PPTX
Program Logic and Design
PPTX
Introduction to Python Programming - I
PPT
Introduction to c_language
PDF
Programming languages and concepts by vivek parihar
PPTX
Pf lec 01 intro
PPT
Fundamental Programming Lect 1
PDF
Lecture # 1
PDF
Coding principles
PPTX
What is programming what are its benefits
PDF
Algorithm pseudocode flowchart program notes
PDF
Principles of-programming-languages-lecture-notes-
PDF
Programing language
PPT
Programming language
PPT
Programming Languages An Intro
PPTX
Programming languages and paradigms
Intermediate Languages
Before Starting Python Programming Language
Subj specsoftware in language
Basic Programming Concept
Introduction to c language
Program Logic and Design
Introduction to Python Programming - I
Introduction to c_language
Programming languages and concepts by vivek parihar
Pf lec 01 intro
Fundamental Programming Lect 1
Lecture # 1
Coding principles
What is programming what are its benefits
Algorithm pseudocode flowchart program notes
Principles of-programming-languages-lecture-notes-
Programing language
Programming language
Programming Languages An Intro
Programming languages and paradigms
Ad

Similar to Lsn02 fundamentals (20)

PDF
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
PPTX
Python | What is Python | History of Python | Python Tutorial
PDF
Introduction to Python - Algorithm Compiler
PDF
Introduction to Python
PPTX
Python Programming for Beginners
PDF
Summer Training Project.pdf
PPTX
Python Intro Slides for Students CSC-148 Chapter 1
DOCX
Preliminary-Examination.docx
PPTX
Introduction to Python.pptx
PDF
Introduction to Python Unit -1 Part .pdf
PDF
Web Programming UNIT VIII notes
PDF
Exploratory Analytics in Python provided by EY.pdf
PPT
Introduction to python
DOCX
Computer Science 111 Computer Science I with Java and Pyth.docx
PDF
Python quick guide1
PPTX
Hello World! with Python
PPTX
MODULE 1.pptx
PDF
PYTHON PROGRAMMING NOTES.pdf
PDF
PYTHO programming NOTES with category.pdf
PPTX
python unit2.pptx
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Python | What is Python | History of Python | Python Tutorial
Introduction to Python - Algorithm Compiler
Introduction to Python
Python Programming for Beginners
Summer Training Project.pdf
Python Intro Slides for Students CSC-148 Chapter 1
Preliminary-Examination.docx
Introduction to Python.pptx
Introduction to Python Unit -1 Part .pdf
Web Programming UNIT VIII notes
Exploratory Analytics in Python provided by EY.pdf
Introduction to python
Computer Science 111 Computer Science I with Java and Pyth.docx
Python quick guide1
Hello World! with Python
MODULE 1.pptx
PYTHON PROGRAMMING NOTES.pdf
PYTHO programming NOTES with category.pdf
python unit2.pptx
Ad

Lsn02 fundamentals

  • 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