Антония обнови решението на 15.03.2012 01:47 (преди почти 13 години)
+def prepare_meal(number):
+ n = 0
+
+ if number % 5 == 0:
+ eggs_res = 'eggs'
+ else:
+ eggs_res = ''
+
+ while number % 3 == 0:
+ number = number / 3
+ n += 1
+
+ if n > 0 and eggs_res:
+ union = str.format(' {0} ', 'and')
+ else:
+ union = ''
+
+ spam = str.format('{0} ', 'spam')
+ spam_res = (spam * n).strip()
+
+ meal = str.format('{0}{1}{2}', spam_res, union, eggs_res)
+
+ return meal