Skip to content

Instantly share code, notes, and snippets.

View buildwithmh's full-sized avatar
🎯
Building stuff

Mo Hajr buildwithmh

🎯
Building stuff
View GitHub Profile
@buildwithmh
buildwithmh / StringBuilder.py
Last active January 1, 2021 16:04
String Builder in python
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)
def is_prime(*, number: int):
stop = int(math.sqrt(number)) + 1
return all(number % divisor != 0 for divisor in range(2, stop))