Skip to content

Latest commit

 

History

History
20 lines (13 loc) · 574 Bytes

6_python_unit_tests.mdx

File metadata and controls

20 lines (13 loc) · 574 Bytes

Python Unit Tests Exercises

Practice exercises for using unit tests with Python.

Prerequisites

In order to complete these exercises, you should know how to:

  • Create variables
  • Use print statements (to print strings and variables)
  • Use basic mathematic operators (+, -, *, /, % etc.)
  • Use relational operators ( >, <, ==, >=, <=, !=)
  • Use logical operators (and, or, not)
  • Create functions

Exercise 1

Write a function that takes a chain as a parameter and returns its size.

Then, write and run 3 unit tests for the function.