Skip to content

Commit

Permalink
Debugging!
Browse files Browse the repository at this point in the history
  • Loading branch information
snehalmastud authored Feb 23, 2020
1 parent bba386c commit a4c8c25
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Debugging/Default Arguments/Solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@


class EvenStream(object):
def __init__(self):
self.current = 0

def get_next(self):
to_return = self.current
self.current += 2
return to_return


class OddStream(object):
def __init__(self):
self.current = 1

def get_next(self):
to_return = self.current
self.current += 2
return to_return


def print_from_stream(n, stream=None):
stream = OddStream() if stream else EvenStream()
for _ in range(n):
print(stream.get_next())

0 comments on commit a4c8c25

Please sign in to comment.