def enrollments(db : {str:{(str,str)}}) -> [(str,int)]:
for node, value in db.items():
lst=[]
lst.append((node, len(value)))
print(lst)
The function tries to read a dictionary and return a two tuple list that contains the name of the key and the number of the values within the key. But when I run it, it shows:
enrollments({'ICS-31': {('Bob', 'A'), ('David', 'C'), ('Carol', 'B')},
'Math-3A': {('Bob', 'B'), ('Alice', 'A')}
})
[('Math-3A', 2)]
Were have I gone wrong?