Петър обнови решението на 13.03.2012 16:18 (преди почти 13 години)
+def prepare_meal(number):
+ eggs = ""
+ if(number % 5 == 0 and number != 0):
+ eggs = "eggs"
+
+ spams = ""
+ while(number % 3 == 0 and number != 0):
+ number /= 3
+ spams +="spam "
+
+ if(eggs == ""):
+ spams = spams[:-1]
+ elif(len(spams)):
+ eggs = "and " + eggs
+
+ return spams + eggs