Permalink
Browse files

add unit-2.5 bonus question: coconuts 4

  • Loading branch information...
1 parent 2fa52e6 commit d9398fbc3df45d8d6a1ea1960f49f3dec17a85da daniel watson committed Mar 3, 2012
Showing with 10 additions and 11 deletions.
  1. +10 −11 unit-2.py
View
@@ -1,20 +1,19 @@
#! /usr/bin/env python
-#Write a function that repeats the process of
-#giving a coconut away and then taking one
-#fifth of the remaining coconuts away.
-
+#Write a program that will find the initial number
+#of coconuts.
def f(n):
- return (n-1) / 5 * 4
+ return (n-1) / 5.0 * 4
def f6(n):
-
- # Enter code here
for i in range(6):
n = f(n)
-
- return n
-
+ return n
+
+def is_int(n):
+ return abs(n-int(n)) < 0.0000001
+
+# Enter code here.
-print f6(96.)
+print n

0 comments on commit d9398fb

Please sign in to comment.