Ad
Code
Diff
  • def find_multiples_of_4_and_6(n):
        return (i for i in range(0,n,2) if not(i%4 and i%6))
    • def find_multiples_of_4_and_6(n):
    • return (i for i in range(n) if not (i%4 and i%6))
    • return (i for i in range(0,n,2) if not(i%4 and i%6))
Code
Diff
  • def days(month,day):
        return sum([31,28,31,30,31,30,31,31,30,31,30,31][:month-1])+day
    • def days(month,day):
    • return[0,31,59,90,120,151,181,212,243,273,304,334][month-1]+day
    • return sum([31,28,31,30,31,30,31,31,30,31,30,31][:month-1])+day
Code
Diff
  • def feed_the_primates(animals, food):
        return [f"🍌{m}" for m in animals if m in "🦍🐒"] if "🍌" in food else 'No bananas!'
    • def feed_the_primates(animals, food):
    • if "🍌" in food:
    • return ["🍌"+ m for m in animals if m in ["🦍", "🐒"] for f in food if f == "🍌"]
    • return 'No bananas!'
    • return [f"🍌{m}" for m in animals if m in "🦍🐒"] if "🍌" in food else 'No bananas!'