Ad
Code
Diff
  • mmr=lambda p,w:(-1)**(not w)*(30-10*p)
    
    • def mmr(party: bool, win: bool) -> int:
    • if party:
    • if win:
    • return 20
    • return -20
    • if win:
    • return 30
    • return -30
    • mmr=lambda p,w:(-1)**(not w)*(30-10*p)
Code
Diff
  • is_even = lambda a: not a%2
    • is_even = lambda a: True if a%2==0 else False
    • is_even = lambda a: not a%2
Code
Diff
  • remove_numbers=lambda string:''.join(i for i in string if not i.isnumeric())
    • import re
    • def remove_numbers(string):
    • return re.sub(r"[0-9]","",string)
    • remove_numbers=lambda string:''.join(i for i in string if not i.isnumeric())
Code
Diff
  • find_multiples=lambda b,l:[*range(b,l+1,b)]
    • def find_multiples(b, l):
    • a=[]
    • for i in range(b,l+1,b):
    • a.append(i)
    • return a
    • find_multiples=lambda b,l:[*range(b,l+1,b)]
Code
Diff
  • def digital_root(n):
        if n>9:
            return digital_root(sum(int(i) for i in str(n)))
        return n
    • def digital_root(n):
    • while n > 9:
    • n = sum([int(i) for i in str(n)])
    • if n>9:
    • return digital_root(sum(int(i) for i in str(n)))
    • return n