swsnu / swppfall2019

31 stars 22 forks source link

[HW1] question about parsed_malenames and parsed_femalenames #39

Open geeglegeegle45 opened 5 years ago

geeglegeegle45 commented 5 years ago

From issue#21, I heard that parsed_malenames and parsed_femalenames ( return value of parse function ) should have a list of tuples, and each tuples shape like (rank, name). It means parse function have to return list of tuples that shape like (number, result of lambda function).

But in example in Usage, when we run python shell and after put

parser.parse(lambda rank_to_names_tuple: rank_to_names_tuple[0]) , the printed answer is >>> ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', ...] It seems like the parse function returns only value of lambda function, not tuple(rank, name). So I wrote in Issue to ask how the return value of parse function should be. Thank you!

안녕하세요, #21번 이슈에서 parsed_malenames 랑 parsed_femalenames 리스트는 각각 (rank, name)으로 된 튜플의 리스트여야 한다고 이해했습니다. 그런데 이말은 곧 parse 함수가 (숫자, 람다식의 함숫값)의 리스트를 리턴하는 것일 텐데요

Usage의 예시에서

parser.parse(lambda rank_to_names_tuple: rank_to_names_tuple[0]) 를 입력했을 때 ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', ...] 가 나오는 것을 보면 parse 함수가 튜플(rank, name)이 아니라 람다식의 값만을 리턴하고 있는 것 같습니다 그래서 parse 함수의 리턴값이 어떻게 되어야 하는지 여쭙고 싶습니다 감사합니다!

uyw4687 commented 5 years ago

As you can see in the comment of the 'parse' method, a parsing lambda processes a single tuple and returns something. lambda rank_to_names_tuple: rank_to_names_tuple[0] gets the first element of each tuple, so the result looks like ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', ...]. Notice that each tuple has its rank and names which are all you need so you can get this information just by processing each tuple.

hy00nc commented 5 years ago

As I mentioned in #21, (rank, name) is the recommended format. Your lambda function needs to be fixed in ordered to do so. Please check how the lambda function works! You're almost there.