Mercurial > hg > swc-python-intro
changeset 6:4ec6aa30a1f8 tip
modified is_data function so that it only returs once
| author | luisf <luis.figueira@eecs.qmul.ac.uk> |
|---|---|
| date | Tue, 05 Feb 2013 18:01:41 +0000 |
| parents | f358a45c148e |
| children | |
| files | python-intro.py |
| diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/python-intro.py Tue Feb 05 17:49:53 2013 +0000 +++ b/python-intro.py Tue Feb 05 18:01:41 2013 +0000 @@ -2,14 +2,18 @@ """ Returns true if the line has data and false otherwise (header, comments, etc)""" + answer = True + if line.startswith('#'): # skip comments - return False + answer = False elif line.startswith('D'): # skip title row - return False + answer = False else: - return True + answer = True + return answer + def count_marlins(data): """Receives a line of data and returns the count of Marlins in that line (zero otherwise)"""
