Ивелин обнови решението на 14.03.2012 02:21 (преди почти 13 години)
+def prepare_meal(number):
+ if number <= 0:
+ return ""
+ pow_num = 0
+ current_num = number
+ add_eggs = False
+ while current_num != 1:
+ if current_num % 5 == 0:
+ add_eggs = True
+ if current_num % 3 != 0:
+ break
+ current_num = current_num / 3
+ pow_num += 1
+
+ res = " ".join("spam" for i in range(pow_num))
+ if add_eggs is True:
+ if len(res) != 0:
+ res += " and eggs"
+ else:
+ res = "eggs"
+ return res