From 0fab4447bd7644b17b75a6d7c2b5c75f807e2586 Mon Sep 17 00:00:00 2001 From: Gunturu Date: Sat, 21 Dec 2019 03:17:42 -0800 Subject: [PATCH] Adding the second assignment --- stream_exercise.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/stream_exercise.py b/stream_exercise.py index c0cf5a5..2e7acb8 100644 --- a/stream_exercise.py +++ b/stream_exercise.py @@ -1,5 +1,5 @@ - +import pdb class StreamProcessor(object): """ Write a stream processor class that does the following: @@ -56,6 +56,15 @@ def process(self): # together. total = 0 # The running total of sums. + while count < 10 and total < 200: + # pdb.set_trace() + digits = self._stream.read(2) + if digits == '' or len(digits) < 2: + break + + count = count + 1 + total = total + int(digits) + # TODO: WRITE CODE HERE: # Just some example syntax, you can read two digits from the head of the