Иво обнови решението на 15.03.2012 14:46 (преди почти 13 години)
+def prepare_meal(number):
+ breakfast = ''.join(['spam ' for spam in range(powers(number))]).strip()
+ if not number % 5:
+ if breakfast == '':
+ breakfast += 'eggs'
+ else:
+ breakfast +=' and eggs'
+ return breakfast
+
+def powers(number):
+ if number % 3:
+ return 0
+ else:
+ return 1 + powers(number // 3)
+