Явор обнови решението на 14.03.2012 05:16 (преди почти 13 години)
+def spam_number(n):
+ cnt = 0
+ while(n % 3 == 0):
+ n /= 3
+ cnt += 1
+ return cnt
+
+
+def eggs(n):
+ return (n % 5 == 0)
+
+
+def prepare_meal(number):
+ spam_meal = ('spam ' * spam_number(number))[:-1]
+ meal = spam_meal
+ if(eggs(number)):
+ if(meal != ''):
+ meal += ' and '
+ meal += 'eggs'
+ return meal