Hi! We had this practice test and I was wondering what the missing blank could be.... here's the code I wrote
def count_members(file: TextIO) -> list[int]:
"""Given an open file containing group information as described above,
return a list containing the number of people in each group.
Every group begins with a GROUP # line (where # is the number for that group).
All member names contain only lower-case letters.
Precondition:
- the file has at least one group
file = open('sample_groups.txt')
>>> count_members(file)
[2, 3, 1]
"""
counts = []
line = file.readline().strip()
while line != '':
group_count = 0
line = file.readline().strip()
while line.islower() and 'GROUP' not in line:
counts.append(group_count)
return countsI was wondering about the third final line for the conditions in the while loop. They asked us to fill out the two conditions between the and and I'm not sure if line.islower() is right.