JCL

FEUP/DEI & INESC TEC

User Tools

Site Tools


teach:fpro:lectures:24

LE24: 21/01/2021

Master in Informatics and Computing Engineering
Programming Fundamentals
Instance: 2020/2021


Lecture #24 :: 21/01/2021

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
    • Catching exceptions [E.1]
    • Raising exceptions [E.2]
    • Revisiting an earlier example [E.3]
    • The finally clause of the try statement [E.4]
    • 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, Release 3rd Edition, 2020 [PDF] (Appendix E)
  • The Python Tutorial, 8. Errors and Exceptions, Python 3.8.7 documentation, January 03, 2021 [HTML] (Section 8)

Materials

Summary

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

FPRO, 2020/21

« Previous | Index

teach/fpro/lectures/24.txt · Last modified: 03/01/2021 21:37 by Correia Lopes