Павлина обнови решението на 10.03.2012 22:54 (преди почти 13 години)
+def prepare_meal(number):
+ str = ''
+ divided_by_3 = 0
+ menu = ['spam', 'eggs', 'and eggs']
+ while number % 3 == 0 and number != 0:
+ if divided_by_3 == 0:
+ str = menu[0]
+ else:
+ str = str + ' ' + menu[0]
+ number = number // 3
+ divided_by_3 += 1
+ if number == 0:
+ pass
+ elif number % 5 == 0 and divided_by_3 == 0:
+ str = menu[1]
+ elif number % 5 == 0 and divided_by_3 > 0:
+ str = str + ' ' + menu[2]
+ return str