Tags » By Aaron

Programming Homework 3

Everything you need is in this secret zip file. (Download the file – right click on it and choose “save as”. If you just click on the link, it will try to open it as a pdf in your browser). 120 more words

Faculty Posts

Optional projects

There are three sets of optional projects available here. Play around with them for an extra challenge and to get a broader sample of computer programming.

Faculty Posts

Goldbach Conjecture functions

# returns True if num is prime, returns False otherwise
def isPrime(num):
    if num < 2:
        return False
    for n in range(2, int(num**0.5)):
        if num % n == 0:
            return False
    return True

# if num is even and greater than 2, returns the two primes that 
# sum to num (or -1 if Goldbach Conjecture is false)
# otherwise returns None
def checkGoldbach(num):
    if num % 2 == 0:
        for i in range(2, int(num/2) + 1):
            if isPrime(i) and isPrime(num - i):
                return i, num - i
        return -1
Faculty Posts

Programming Homework 1

Everything you need is in this zip file. Remember you can choose to do either the exercises or the projects (or the first two projects and last two exercises).

Faculty Posts