### dramforever's Kumite #128

Code
Diff
• ``````def solution():
__import__('__main__').refsol()
``````
• def solution():
• import __main__
• __main__.refsol()
• __import__('__main__').refsol()

### Classes : Student

Code
Diff
• ``````from random import choice

class Student:

self.first_name = first_name
self.last_name = last_name

@property
def full_name(self):
return f'{self.first_name} {self.last_name}'

@property
def email(self):
return f'{self.first_name}{self.last_name[0]}@codewars.com'

@property

@property
return (('A', 90), ('B', 80), ('C', 70), ('D', 65))

def assess(self):
return 'F'

``````
• from random import choice
• class Student:
• def __init__(self, first_name, last_name, grades=[]):
• self.first_name = first_name
• self.last_name = last_name
• @property
• def full_name(self):
• return f'{self.first_name} {self.last_name}'
• @property
• def email(self):
• return f'{self.first_name}{self.last_name[0]}@codewars.com'
• @property
• @property
• return (('A', 90), ('B', 80), ('C', 70), ('D', 65))
• def assess(self):
• return 'F'

### Are there three

Code
Diff
• ``````interface Kumite {
static boolean hasThree(int x) {
return x % 10 == 3 ? true : x < 10 ? false: hasThree(x/10);
}
}``````
• interface Kumite {
• static boolean hasThree(int x) {
• return (x + "").contains("3") ;
• return x % 10 == 3 ? true : x < 10 ? false: hasThree(x/10);
• }
• }

### H

Code
Diff
• ``theletterh=lambda x:"".join("H" for _ in range(x))``
• "H".__mul__
• theletterh=lambda x:"".join("H" for _ in range(x))

### Поиск подстроки внутри другой строки

Code
Diff
• ``find_first_sub_string=lambda text,sub:[None, index:=text.find(sub)][index>-1]``
• find_first_sub_string = lambda text, sub: next(filter(lambda x: x>-1, [text.find(sub)]), None)
• find_first_sub_string=lambda text,sub:[None, index:=text.find(sub)][index>-1]

### Поиск подстроки внутри другой строки

Code
Diff
• ``````def find_first_sub_string(text: str,
sub: str) -> int:

return [None, index:=text.find(sub)][index>-1]``````
• def find_first_sub_string(text: str,
• sub: str):
• return index if ~(index:= text.find(sub)) else None
• sub: str) -> int:
• return [None, index:=text.find(sub)][index>-1]

### Convert Binary to Decimal

Code
Diff
• ``````def convert_binary_decimal(number):
return int(str(number), 2)``````
• def convert_binary_decimal(number):
• return sum(int(val)*2**power for power, val in enumerate(str(number)[::-1]))
• return int(str(number), 2)

### Reverse a string

Code
Diff
• ``const revstr = str => [...str].reverse().join````
• const revstr = str => [...str].reverse().join('')
• const revstr = str => [...str].reverse().join``

### remove all numbers from string

Code
Diff
• ``````digits = "0123456789".__contains__

remove_numbers=lambda x:''.join(map(lambda x: x if not digits(x) else "", x))``````
• remove_numbers=lambda string:''.join(i for i in string if not i.isnumeric())
• digits = "0123456789".__contains__
• remove_numbers=lambda x:''.join(map(lambda x: x if not digits(x) else "", x))

### Reverse a string

Code
Diff
• ``const revstr = str => str.split('').reverse().join````
• const revstr = str => str.split('').reverse().join('')
• const revstr = str => str.split('').reverse().join``

### Testing

Code
Diff
• ``add = lambda *x: sum(x)``
• return a + b
• add = lambda *x: sum(x)

### XRFXLP's Kumite #150

Code
Diff
• ``````def add(a, b):
return (a**2-b**2)//(a-b) if a!=b else a*2``````
• return (a**2-b**2)//(a-b)
• return (a**2-b**2)//(a-b) if a!=b else a*2

### XRFXLP's Kumite #150

Code
Diff
• ``````def add(a, b):
return (a**2-b**2)//(a-b)``````
• return a + b
• return (a**2-b**2)//(a-b)

### Is it odd?

Fundamentals
Numbers
Data Types
Integers
Code
Diff
• ``is_odd = lambda x: not ~x&1``
• is_odd = lambda x: x&1
• is_odd = lambda x: not ~x&1