Skip to content

First bonus exercise, for the ones comfortable enough with python.

Notifications You must be signed in to change notification settings

YasarL/bonus01

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bonus Homework 01

This exercise assumes that you already solved the first homework and installed python and git. Once you cloned this git repository, make sure that you activate the conda-environment for the shell you use to run python in.

Make sure that your code of the bonus exercise and of the first regular homework are not mixed up! Every exercise has to be commited to the repository you originally pulled from.

Finding Prime Numbers

Your task for this exercise is to provide two functions, namely the function is_prime and the function find_prime. The first of those is supposed to take any natural number and return True if it is a prime number, and False otherwise. find_prime(7) for example is supposed to return True.

The find_prime method is supposed to find the nth prime number there is - which means find_prime(1) is supposed to return the first prime number there is, namely 2. The first six prime numbers being 2,3,5,7,11 and 13, find_prime(6) is supposed to return 13.

There are ways to find the nth prime number without having to test every single one from the first on (see for example this stackoverflow answer), but as you can see in the file test_prime.py, which contains the tests run by pytest, you need to implement both methods in order to pass the test.

About

First bonus exercise, for the ones comfortable enough with python.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%