jealousDonutEaters [25 pts]
Note: This is the same as on
quiz2, only now you can use loops and conditionals if it helps.
Say that 5 people order 1 dozen donuts. First, everyone gets 2 donuts,
leaving 2 extra. So then 2 of them each get an extra donut, and 3 of
them are now jealous since they did not get an extra donut. With this
in mind, write the function jealousDonutEaters(p, d), that takes two
non-negative integers p and d, and assuming that p people are eating d dozen
donuts, returns the number of people that will be jealous because they got
one fewer than some others. Important: once someone has eaten at
least 4 donuts, they will not be jealous even if someone else eats more
donuts. In case it helps you understand the problem, here is a sample
test function:def testJealousDonutEaters():
print "Testing jealousDonutEaters()...",
assert(jealousDonutEaters( 5, 1) == 3) # 2 get 3, 3 get 2, 3 jealous
assert(jealousDonutEaters( 4, 1) == 0) # 3 each, none jealous
assert(jealousDonutEaters(13, 3) == 3) # 10 get 3, 3 get 2
assert(jealousDonutEaters( 5, 2) == 0) # all get at least 4, none jealous
assert(jealousDonutEaters( 0, 2) == 0) # nobody to get jealous!
assert(jealousDonutEaters( 2, 0) == 0) # no donuts to be jealous of!
print "Passed!"