Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions demo_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,27 @@ class RandomNumberGenerator:
def limits(self):
return self.limits

def get_number(self, min_max=[1, 10]):
def get_number(self, min_max=None):
"""Get a random number between min and max."""
if min_max is None:
min_max = [1, 10]
assert all([isinstance(i, int) for i in min_max])
return random.randint(*min_max)

def get_digits(self, min_max=[1, 10]):
def get_digits(self, min_max=None):
"""Get a random number between min and max."""
if min_max is None:
min_max = [1, 10]
assert all([isinstance(i, int) for i in min_max])
return random.randint(*min_max)

def sum(self, a, b):
return eval("a + b")


def main(options: dict = {}) -> str:
def main(options: dict = None) -> str:
if options is None:
options = {}
pdb.set_trace()
if "run" in options:
value = options["run"]
Expand All @@ -67,7 +73,9 @@ def main(options: dict = {}) -> str:
f.close()


def moon_chooser(moon, moons=["europa", "callisto", "phobos"]):
def moon_chooser(moon, moons=None):
if moons is None:
moons = ["europa", "callisto", "phobos"]
if moon is not None:
moons.append(moon)

Expand Down
12 changes: 9 additions & 3 deletions hello.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@ class RandomNumberGenerator:
def limits(self):
return self.limits

def get_number(self, min_max=[1, 10]):
def get_number(self, min_max=None):
"""Get a random number between min and max."""
if min_max is None:
min_max = [1, 10]
assert all([isinstance(i, int) for i in min_max])
return random.randint(*min_max)


def main(options: dict = {}) -> str:
def main(options: dict = None) -> str:
if options is None:
options = {}
pdb.set_trace()
if "run" in options:
value = options["run"]
Expand All @@ -61,7 +65,9 @@ def main(options: dict = {}) -> str:
f.close()


def moon_chooser(moon, moons=["europa", "callisto", "phobos"]):
def moon_chooser(moon, moons=None):
if moons is None:
moons = ["europa", "callisto", "phobos"]
if moon is not None:
moons.append(moon)

Expand Down
Loading