1 / 14

Day 1 – Lesson 2 Fundamentals of Programming Languages

Day 1 – Lesson 2 Fundamentals of Programming Languages. Python Mini-Course University of Oklahoma Department of Psychology. Lesson objectives. Describe the basic structure of the Python language Use the IDLE interactive interpreter

Download Presentation

Day 1 – Lesson 2 Fundamentals of Programming Languages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Day 1 – Lesson 2Fundamentals of Programming Languages Python Mini-Course University of Oklahoma Department of Psychology Python Mini-Course: Day 1 - Lesson 2

  2. Lesson objectives • Describe the basic structure of the Python language • Use the IDLE interactive interpreter • Identify three kinds of errors that occur in programming and describe how to correct them Python Mini-Course: Day 1 - Lesson 2

  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 Python Mini-Course: Day 1 - Lesson 2

  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 Python Mini-Course: Day 1 - Lesson 2

  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 Python Mini-Course: Day 1 - Lesson 2

  6. Starting IDLE Python Mini-Course: Day 1 - Lesson 2

  7. Programs • Programs are sequences of instructions • Input • Output • Math and data manipulation • Conditional execution • Repetition Python Mini-Course: Day 1 - Lesson 2

  8. The “Hello, World” program Python Mini-Course: Day 1 - Lesson 2

  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 Python Mini-Course: Day 1 - Lesson 2

  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 Python Mini-Course: Day 1 - Lesson 2

  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 Python Mini-Course: Day 1 - Lesson 2

  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 Python Mini-Course: Day 1 - Lesson 2

  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) Python Mini-Course: Day 1 - Lesson 2

  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 Python Mini-Course: Day 1 - Lesson 2

More Related