Revision 6:4ec6aa30a1f8
| python-intro.py | ||
|---|---|---|
| 2 | 2 |
""" Returns true if the line has data |
| 3 | 3 |
and false otherwise (header, comments, etc)""" |
| 4 | 4 |
|
| 5 |
answer = True |
|
| 6 |
|
|
| 5 | 7 |
if line.startswith('#'):
|
| 6 | 8 |
# skip comments |
| 7 |
return False
|
|
| 9 |
answer = False
|
|
| 8 | 10 |
elif line.startswith('D'):
|
| 9 | 11 |
# skip title row |
| 10 |
return False
|
|
| 12 |
answer = False
|
|
| 11 | 13 |
else: |
| 12 |
return True |
|
| 14 |
answer = True |
|
| 15 |
return answer |
|
| 16 |
|
|
| 13 | 17 |
|
| 14 | 18 |
def count_marlins(data): |
| 15 | 19 |
"""Receives a line of data and returns the count of Marlins in that line (zero otherwise)""" |
Also available in: Unified diff