1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Testing in Python

Exercise

Is prime or not

A prime number can only be divided by itself and 1 without remainders. In this exercise, you will test the function the is_prime() with unittest. The function gets a number and returns True if it is prime and False if it is not. It uses the math package to calculate the square root of the number. The packages math and unittest were already imported for you.

Instructions 1/3

undefined XP
  • 1
    • Implement a test to check that 17 is prime.
  • 2
    • Implement a test to check that 6 is not prime.
  • 3
    • Implement a test to check that 1 is not prime.