Problem 5: Fractal Sun (20 points)
Using Python's Tkinter library, you will paint a majestic fractal sun. The fractal sun is composed
of a circle of radius r, and 8 rays of length 2*r originating from the center of the circle and
radially equally spaced.
A. Djibouti (7 pts)
In the file 4b.djiboutiFlag.py, include the helper function
drawFlagOfDjibouti(canvas, left, top, right, bottom) along with the code
required to display the flag in the 4 quadrants of a canvas, as described above.
Note: For simplicity,
A. Qatar (13 pts)
In the file 5b.qatarFlag.py, include the helper function
drawFlagOfQatar(canvas, left, top, right, bottom) along with the code required
to display the flag in the 4 quadrants of a canvas, as described above.
Note: the black border was ad
A. Note: Here you can use circles instead of stars, but if you solved the EU flag,
then you should use stars here, too (even though you won't get double-credit for
so doing - it'll just look nicer!).
Note: +2 points for getting the layout of the stars rig
5. Bonus/Optional (5 points). What does the function mystery(n, m) compute? Explain
more than one sentence) in terms of what the function is supposed to accomplish, not
def mystery(n, m):
while (n > 1):
if (n % m !
Problem 1.B. (3 points)
def mysteryB(s1, a, b):
if (a < 0) or (b <= a) or (b >= len(s1):
return mysteryB(s1, a, b-1) + s1[b-1]
Problem 1.C. (4 points)
def mysteryC(x, y):
if (x < 0):
return -mysteryC(-x, y)
elif (y < 0):
A. countFiles (15 points)
Write the recursive function countFiles(path), which takes a string specifying a path to a
folder and returns the total number of files in that folder (and all its subfolders). Do not
count folders (or subfolders) as files. Do no
Problem 3: Fractal flowers (20 points; 5 points for simpleFlower; 15
points for fractalFlower)
A. Write a function simpleFlower(size) that takes an integer number representing the size
of the flower. Your function will draw the following figure:
Problem 4: Fractal Mickey Mouse (20 points; 5 points for mickeyFace;
15 points for fractalMickeyMouse)
Using Python's Tkinter library, you will create a funny fractal cartoon character inspired by
Disney's Mickey Mouse.
A. Write a function mickeyFace(canv
Aside: do you see the obvious top-down design here? To write nthPerfect, we needed
isPerfect, and for that we needed sumOfProperFactors. These are well-chosen helper
functions that not only help us with our goal (nthPerfect), but stand on their own as