J. Correia Lopes

FEUP/DEI & INESC TEC

User Tools

Site Tools


teach:fpro:lectures:23

T: 18/12/2018

Master in Informatics and Computing Engineering
Programming Fundamentals
Instance: 2018/2019


Lecture #23 :: 18/12/2018

Goals

By the end of this class, the student should be able to:

  • Write code to catch and handle runtime exceptions that may occur during program execution
  • Raise exceptions when a program detects an error condition
  • Assert conditions that must be true during execution

Content

  • Exceptions
    • E.1 Catching exceptions
    • E.2 Raising exceptions
    • E.3 Revisiting an earlier example
    • E.4 The finally clause of the try statement
    • The assert statement
    • Summary

Bibliography

  • Peter Wentworth, Jeffrey Elkner, Allen B. Downey, and Chris Meyers, How to Think Like a Computer Scientist — Learning with Python 3, 2018 (Appendix E) PDF

Materials

  • J. Correia Lopes, Script and illustrations, 23-exceptions.pdf
  • FPRO, 2018/19, Python code, Lecture's on GitHub
  • The Python Tutorial, 8. Exceptions, Python 3.6.7 documentation, Release 3.6.7, November 20, 2018 HTML

Summary

  • Errors and runtime exceptions. Catching exceptions. Raising own exceptions. Assertions.

FPRO, 2018/19

« Previous | Index | Next »

teach/fpro/lectures/23.txt · Last modified: 16/12/2018 11:58 by Correia Lopes