Ad
Code
Diff
  • prod = lambda numbers: numbers[0] * (prod(numbers[1:]) or 1) if numbers else 0
    • def prod(numbers):
    • return numbers[0] * (prod(numbers[1:]) or 1) if len(numbers) else 0
    • prod = lambda numbers: numbers[0] * (prod(numbers[1:]) or 1) if numbers else 0
Code
Diff
  • remove = lambda s: ''.join(x for x in s if x.islower())
    • def remove(string):
    • return ''.join(x for x in string if x.islower())
    • remove = lambda s: ''.join(x for x in s if x.islower())
Code
Diff
  • sort_names = lambda s:' '.join(sorted(s.title().split()))
    • def sort_names(s):
    • return ' '.join(sorted(s.title().split()))
    • sort_names = lambda s:' '.join(sorted(s.title().split()))
Fundamentals
Code
Diff
  • e=lambda n:n-n%2
    • e=lambda n:n-(n&1)
    • e=lambda n:n-n%2
Code
Diff
  • vat = 0.1
    lux = 0.3
    final_price = lambda price: round(price*(1+(vat+lux if price >= 1000 else vat)), 2)
    • def final_price(price):
    • vat = 0.1
    • lux = 0.3
    • return round(price*(1+vat+lux),2) if price >= 1000 else round(price*(1+vat),2)
    • vat = 0.1
    • lux = 0.3
    • final_price = lambda price: round(price*(1+(vat+lux if price >= 1000 else vat)), 2)
Code
Diff
  • def prod(numbers):
        return numbers[0] * (prod(numbers[1:]) or 1) if len(numbers) else 0
    • def prod(numbers):
    • if not len(numbers):
    • return 0
    • return numbers[0] * (prod(numbers[1:]) or 1)
    • return numbers[0] * (prod(numbers[1:]) or 1) if len(numbers) else 0