Александър обнови решението на 14.03.2012 18:45 (преди почти 13 години)
+def prepare_meal(number):
+ '''yay that wasn't the original solution.
+ but the other one is boring.
+ btw https://github.com/cburroughs/pep8.py doesn't recognize //= (pep8 in jcrocholl's repo does).
+ '''
+ spams = []
+
+ while number % 3 == 0: # 0 is handled as well.
+ spams.append('spam')
+ number //= 3
+ if number % 5 == 0 and number > 0:
+ if len(spams) > 0:
+ spams.append('and')
+ spams.append('eggs')
+ return ' '.join(spams)
+