Стела обнови решението на 09.03.2012 20:07 (преди почти 13 години)
+def divide_by_3(spam, power=0):
+ if not spam % 3:
+ return divide_by_3(spam / 3, power + 1)
+ return(power * 'spam ')
+
+def divide_by_5(eggs):
+ if eggs%5:
+ return ''
+ return 'eggs'
+
+def prepare_meal(number):
+ how_much_spam = divide_by_3(number)
+ any_eggs = divide_by_5(number)
+ if how_much_spam and any_eggs:
+ return '{0}and {1}'.format(how_much_spam, any_eggs)
+ return '{0}{1}'.format(how_much_spam[:-1], any_eggs)