Add complete assignment description and testing code.

This commit is contained in:
Rob Hess
2019-04-05 12:54:48 -07:00
commit 357d56bc96
9 changed files with 497 additions and 0 deletions

6
testing_code/p1.py Normal file
View File

@@ -0,0 +1,6 @@
r = 8.0
pi = 3.1415
circle_area = pi * r * r
circle_circum = pi * 2 * r
sphere_vol = (4.0 / 3.0) * pi * r * r * r
sphere_surf_area = 4 * pi * r * r

14
testing_code/p2.py Normal file
View File

@@ -0,0 +1,14 @@
a = True
b = False
x = 7
if a:
x = 5
if b:
y = 4
else:
y = 2
z = (x * 3 * 7) / y
if z > 10:
y = 5

9
testing_code/p3.py Normal file
View File

@@ -0,0 +1,9 @@
# Foo computes some function of a, b, and c.
def foo(a, b, c):
x = a * b
y = x / c
z = y * y
return z
foo(1, 2, 3)
foo(1.0, 2.0, 3.0)

19
testing_code/p4.py Normal file
View File

@@ -0,0 +1,19 @@
# This function computes and returns the n'th Fibonacci number.
def fib(n):
f0 = 0
f1 = 1
i = 0
while i < n:
fi = f0 + f1
f0 = f1
f1 = fi
i = i + 1
return f0
fib(0)
fib(1)
fib(2)
fib(3)
fib(4)
fib(5)