This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StringBuilder(object): | |
def __init__(self, val): | |
self.store = [val] | |
def __iadd__(self, value): | |
self.store.append(value) | |
return self | |
def __str__(self): | |
return "".join(self.store) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_prime(*, number: int): | |
stop = int(math.sqrt(number)) + 1 | |
return all(number % divisor != 0 for divisor in range(2, stop)) |