lawrenceemenike / Prime-Number-checker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prime Numbers

Instructions

Prime numbers are numbers that can only be cleanly divided by itself and 1.

https://en.wikipedia.org/wiki/Prime_number

You need to write a function that checks whether if the number passed into it is a prime number or not.

e.g. 2 is a prime number because it's only divisible by 1 and 2.

But 4 is not a prime number because you can divide it by 1, 2 or 4.

Here are the numbers up to 100, prime numbers are highlighted in yellow:

Example Input 1

73

Example Output 1

It's a prime number.

Example Input 2

75

Example Output 2

It's not a prime number.

Hint

  1. Remember the modulus:

https://stackoverflow.com/questions/4432208/what-is-the-result-of-in-python

  1. Make sure you name your function/parameters the same as when it's called on the last line of code.

  2. Use the same wording as the Example Outputs to make sure the tests pass.

Test Your Code

Before checking the solution, try copy-pasting your code into this repl:

https://repl.it/@appbrewery/day-8-2-test-your-code

This repl includes my testing code that will check if your code meets this assignment's objectives.

Solution

https://repl.it/@appbrewery/day-8-2-solution

About


Languages

Language:Python 100.0%