Difference between revisions of "MC1-Homework-1"

From Quantitative Analysis Software Courses
Jump to navigation Jump to search
Line 1: Line 1:
 
==Overview==
 
==Overview==
  
The purpose of this assignment is to get you started programming in Python with a simple task.  Note that we'll be using Python 2.7 for this course (not Python 3.0).  This assignment is structured like many of the homeworks and projects for this course, namely that you are to create a Python function that solves a particular problem.  We will call your function and verify that it provides the correct answer.
+
The purpose of this assignment is to get you started programming in Python.  Note that we'll be using Python 2.7 for this course (not Python 3.0).  This assignment is structured like many of the homeworks and projects for this course, namely that you are to create a Python function that solves a specific problem.  We will call your function and verify that it provides the correct answer.
  
 
==Task==
 
==Task==

Revision as of 23:03, 16 April 2015

Overview

The purpose of this assignment is to get you started programming in Python. Note that we'll be using Python 2.7 for this course (not Python 3.0). This assignment is structured like many of the homeworks and projects for this course, namely that you are to create a Python function that solves a specific problem. We will call your function and verify that it provides the correct answer.

Task

Your task for this homework is to write a Python function nth_prime(N) that computes and returns the Nth prime number. A prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself. If we were to call your function in a Python interpreter, we'd expect output like this:

>>> nth_prime(1)
2
>>> nth_prime(5)
11