### bmi calculator

Code
Diff
• ``````#bmi_calculator = lambda w, h: f'there is{" no"*(w / h / h < 25)} excess weight'
bmi_calculator=lambda w,h:f'there is{" no"*(w/h/h<25)} excess weight'``````
• def bmi_calculator (weight, height):
• return "there is no excess weight" if weight / (height ** 2) < 25 else "there is excess weight"
• #bmi_calculator = lambda w, h: f'there is{" no"*(w / h / h < 25)} excess weight'
• bmi_calculator=lambda w,h:f'there is{" no"*(w/h/h<25)} excess weight'

### Check Even Number (Without Spaces or Numbers)

Fundamentals
Code
Diff
• ``````is_even=lambda*x:~x[int()]%(True+True)
#This comment is allowed tho``````
• is_even(){__asm("mov%rdi,%rax\nshr%rax\nshl%rax\ncmp%rax,%rdi\nsete%al\nleave\nret");}
• is_even=lambda*x:~x[int()]%(True+True)
• #This comment is allowed tho

### Sort string

Code
Diff
• ``sort = lambda x: ''.join(sorted(filter(str.isalnum, x), key=lambda y: (y.isdigit(), y)))``
• def sort(s):
• from string import ascii_lowercase, ascii_uppercase
• alphabet = list(ascii_uppercase) + list(ascii_lowercase) + list("0123456789")
• out = ""
• for letter in alphabet:
• for char in s:
• if char == letter:
• out += char
• return out
• sort = lambda x: ''.join(sorted(filter(str.isalnum, x), key=lambda y: (y.isdigit(), y)))

### Are there three

Code
Diff
• ``````#define true 1
#define false 0

int three_in(int x) {
return x%10 == 3? true : (x > 9? three_in(x/10) : false);
}``````
• fn solution(x: i32) -> bool {
• x.to_string().chars().any(|x| x == '3')
• #define true 1
• #define false 0
• int three_in(int x) {
• return x%10 == 3? true : (x > 9? three_in(x/10) : false);
• }

### H

Code
Diff
• ``theletterh = 'H'.__mul__``
• theletterh = lambda howmuchh: 'H' * howmuchh
• #H return and H print (H😀😃😁)
• theletterh = 'H'.__mul__

### Pavlj's Kumite #2

Now what if we follow this rule: `select one of item and repeat it for selected ranges`. Assuming the value will only repeat it once in the first place it's found

Code
Diff
• ``````#spawn_to_range = lambda l, x, n: l[:(i:=l.index(x))] + [x]*n + l[i+1:] if x in l else l
spawn_to_range=lambda l,x,n:l[:(i:=l.index(x))]+[x]*n+l[i+1:]if x in l else l``````
• #spawn_to_range = s = lambda l, x, n: l[:(i:=l.index(x))] + [x]*n + s(l[i+1:], x, n) if x in l else l
• spawn_to_range=s=lambda l,x,n:l[:(i:=l.index(x))]+[x]*n+s(l[i+1:],x,n)if x in l else l
• #spawn_to_range = lambda l, x, n: l[:(i:=l.index(x))] + [x]*n + l[i+1:] if x in l else l
• spawn_to_range=lambda l,x,n:l[:(i:=l.index(x))]+[x]*n+l[i+1:]if x in l else l

### Pavlj's Kumite #2

Assuming that the value can appear more than once (even though it says `select one of item and repeat it for selected ranges`), you can do it like this.

Code
Diff
• ``````#spawn_to_range = s = lambda l, x, n: l[:(i:=l.index(x))] + [x]*n + s(l[i+1:], x, n) if x in l else l
spawn_to_range=s=lambda l,x,n:l[:(i:=l.index(x))]+[x]*n+s(l[i+1:],x,n)if x in l else l``````
• def spawn_to_range(arr, val, ran):
• return
• #spawn_to_range = s = lambda l, x, n: l[:(i:=l.index(x))] + [x]*n + s(l[i+1:], x, n) if x in l else l
• spawn_to_range=s=lambda l,x,n:l[:(i:=l.index(x))]+[x]*n+s(l[i+1:],x,n)if x in l else l

### Collatz Conjecture

Algorithms
Fundamentals

Using recursion approach that obviously is limited to the stack limit. Or you know just edit the recursion limit using `sys`

Code
Diff
• ``````#collatz = c = lambda n, x=0: c( [ n//2, 3*n + 1 ][ n%2 ], x + 1 ) if n > 1 else x
#collatz = c = lambda n: 1 + c( [ n//2, 3*n + 1 ][ n%2 ] ) if n > 1 else 0
collatz=c=lambda n:1+c([n//2,3*n+1][n%2])if n>1else 0``````
• def collatz(n):
• attempts = 0
• while n != 1:
• if n % 2:
• n = (3*n+1) // 2
• attempts += 2
• else:
• n //= 2
• attempts += 1
• return attempts
• #collatz = c = lambda n, x=0: c( [ n//2, 3*n + 1 ][ n%2 ], x + 1 ) if n > 1 else x
• #collatz = c = lambda n: 1 + c( [ n//2, 3*n + 1 ][ n%2 ] ) if n > 1 else 0
• collatz=c=lambda n:1+c([n//2,3*n+1][n%2])if n>1else 0

Code
Diff
• ``````#grade_calc = lambda s: 'FDCBAA'[max(5, int(s//10)) - 5] if 0 <= s <= 100 else 'Not a grade'

grade_calc = lambda s: 'FFFFFFDCBAA'[int(s//10)] if 0 <= s <= 100 else 'Not a grade'``````
• return 'Not a grade' if score not in range(101) else ["F", "F", "F", "F", "F", "F", "D", "C", "B", "A", "A"][score // 10]
• #grade_calc = lambda s: 'FDCBAA'[max(5, int(s//10)) - 5] if 0 <= s <= 100 else 'Not a grade'
• grade_calc = lambda s: 'FFFFFFDCBAA'[int(s//10)] if 0 <= s <= 100 else 'Not a grade'

### Are there threes?

Code
Diff
• ``solution = lambda n: '3' in str(n)``
• def solution(n):
• return '3' in [i for i in str(n)]
• solution = lambda n: '3' in str(n)

### Vowels at sentence

Code
Diff
• ``import re; count_vowel = lambda x: len(re.sub('(?i)[^aiueo]', '', x))``
• def count_vowel(s):
• return len([1 for i in s.lower() if i in 'aeiou'])
• import re; count_vowel = lambda x: len(re.sub('(?i)[^aiueo]', '', x))

### Convert Binary to Decimal

Code
Diff
• ``````def convert_binary_decimal(number):
return sum(int(val)*2**power for power, val in enumerate(str(number)[::-1]))``````
• def convert_binary_decimal(number):
• number = [int(figure) for figure in str(number)]
• number.reverse()
• return sum(number[bit]*2**bit for bit in range(len(number)))
• return sum(int(val)*2**power for power, val in enumerate(str(number)[::-1]))

### Check Even Number

Bitwise Not, shorter and shorter

Code
Diff
• ``is_even = lambda x: ~x%2``
• is_even = lambda a: not a%2
• is_even = lambda x: ~x%2

### Check Even Number

Code
Diff
• ``is_even = lambda x: 1 + x&1``
• function isEven(input) {
• return true;
• }
• is_even = lambda x: 1 + x&1

### Club's riddle

Fundamentals
Games
Code
Diff
• ``riddle = lambda word: word.find('?')``
• def riddle(word):
• return len(word) - 1
• riddle = lambda word: word.find('?')