Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Building stuff

Mo Hajr MohamedHajr

🎯
Building stuff
View GitHub Profile
@MohamedHajr
MohamedHajr / StringBuilder.py
Last active Feb 20, 2019
String Builder in python
View StringBuilder.py
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)
View is_prime
def is_prime(*, number: int):
stop = int(math.sqrt(number)) + 1
return all(number % divisor != 0 for divisor in range(2, stop))
You can’t perform that action at this time.