Габриела обнови решението на 15.03.2012 01:05 (преди почти 13 години)
+def prepare_meal(ingredients):
+ if not ingredients:
+ return ''
+
+ spam = ''
+ while ingredients % 3 == 0:
+ spam += 'spam '
+ ingredients /= 3
+
+ eggs = 'eggs' if ingredients % 5 == 0 else ''
+
+ return spam + 'and ' + eggs if spam and eggs \
+ else spam[:-1] if not eggs \
+ else eggs