Албена обнови решението на 09.03.2012 13:02 (преди почти 13 години)
+def prepare_meal(number):
+ meal = ""
+ specialDivisors = [n for n in range(1, number) if number % 3 ** n == 0]
+ specialDivNum = len(specialDivisors)
+
+ if specialDivisors:
+ spamNum = specialDivisors[specialDivNum - 1]
+ meal = ("spam " * (spamNum - 1)) + "spam"
+
+ if number % 5 == 0:
+ if specialDivisors:
+ meal += " and eggs"
+ else:
+ meal += "eggs"
+ return meal
Прочети отново PEP 8