Виктор обнови решението на 14.03.2012 04:37 (преди почти 13 години)
+# problem 1
+# let prepare something to eat
+
+
+def prepare_meal(number):
+
+ if number == 0:
+ return ''
+
+ else:
+
+ n = 0
+ meal = []
+
+ while (number % (3 ** n)) == 0 and (number % (3 ** (n + 1))) == 0:
+ n += 1
+ meal.append('spam')
+
+ if (number % 5) == 0:
+ if not meal:
+ meal.append('eggs')
+ else:
+ meal.append('and eggs')
+
+ return ' '.join(meal)