diff --git a/task-01/completed.md b/task-01/completed.md index bca9187..baec4d1 100644 --- a/task-01/completed.md +++ b/task-01/completed.md @@ -1,2 +1,2 @@ ## Those who have completed this task: - +hsnee diff --git a/task-03/get_top_names.py b/task-03/get_top_names.py index 4535204..85d915a 100644 --- a/task-03/get_top_names.py +++ b/task-03/get_top_names.py @@ -9,12 +9,21 @@ def extract_data_lines(filename, start_text, end_text): open `filename`, and yield the lines between the line that contains `start_text` and the line that contains `end_text` """ - # fill in code as needed + turn_on = False with open(filename) as fh: for line in fh: - # fill in code as needed - # use `yield line` to return desired lines but keep the function going + if turn_on=='done': break + if end_text in line: + turn_on = 'done' + if include_end: yield line + + if turn_on: yield line + + if start_text in line: + turn_on = True + if include_start: yield line + if __name__ == '__main__': filename = 'top5names.html'