Дарина обнови решението на 11.03.2012 21:44 (преди почти 13 години)
+def multiple_by_three(number):
+ k = 1
+ while number % 3 ** k == 0:
+ k += 1
+ return 'spam' + ' spam' * (k-2)
+
+
+def multiple_by_five(number):
+ if number % 3 != 0:
+ return 'eggs'
+ else:
+ return multiple_by_three(number) + ' and eggs'
+
+
+def prepare_meal(number):
+ if number % 5 == 0:
+ return multiple_by_five(number)
+ elif number % 3 == 0:
+ return multiple_by_three(number)
+ else:
+ return ''