Методи обнови решението на 11.03.2012 20:03 (преди почти 13 години)
+def prepare_meal(number):
+ """it takes int as argument and return string consisted of spam
+
+ and eggs fragments, indicating number of times argument can be
+
+ divided by 3 (spam) and divided by 5 (eggs)
+
+ """
+
+ result_string = ''
+
+ while not number % 3 and number:
+ result_string += 'spam'
+ number /= 3
+ if not number % 3:
+ result_string += ' '
+
+ if result_string is not '' and not number % 5 and number:
+ result_string += ' and '
+
+ while not number % 5 and number:
+ result_string += 'eggs'
+ number /= 5
+ if not number % 5:
+ result_string += ' '
+
+ return result_string