Kumite (ko͞omiˌtā) is the practice of taking techniques learned from Kata and applying them through the act of freestyle sparring.
You can create a new kumite by providing some initial code and optionally some test cases. From there other warriors can spar with you, by enhancing, refactoring and translating your code. There is no limit to how many warriors you can spar with.
A great use for kumite is to begin an idea for a kata as one. You can collaborate with other code warriors until you have it right, then you can convert it to a kata.
-6 bytes
- Removed spaces around comparison
- Used len() instead of count
-14 bytes, we could've just been using ternary all along!
class OrdinalNumbers: def __init__(self, n): self.n = n def solution(self): t = int(str(self.n)[-1])-1 return str(self.n)+ ("th" if ((self.n>10) and (self.n<20)) else (["st", "nd", "rd"][t:t+1] or ["th"])[0])
- class OrdinalNumbers:
- def __init__(self, n):
- self.n = n
- def solution(self):
if (self.n>10) and (self.n<20): return (str(self.n)+"th")elif (str(self.n)[-1]=="1"): return (str(self.n)+"st")elif (str(self.n)[-1]=="2"): return (str(self.n)+"nd")elif (str(self.n)[-1]=="3"): return (str(self.n)+"rd")else: return (str(self.n)+"th")- t = int(str(self.n)[-1])-1
- return str(self.n)+ ("th" if ((self.n>10) and (self.n<20)) else (["st", "nd", "rd"][t:t+1] or ["th"])[0])
from typing import Sequence, Optional def missing_integer(sequence: Sequence[int]) -> Optional[int]: return next((i + sequence[0] for i, num in enumerate(sequence) if num != i + sequence[0]), None)
- from typing import Sequence, Optional
- def missing_integer(sequence: Sequence[int]) -> Optional[int]:
for i in range(len(sequence)):if sequence[i] != i + sequence[0]:return i + sequence[0]- return next((i + sequence[0] for i, num in enumerate(sequence) if num != i + sequence[0]), None)