Skip to content

Conversation

jaykxo
Copy link
Member

@jaykxo jaykxo commented Sep 11, 2025

냅다 반복문만 돌리기........

@jaykxo jaykxo self-assigned this Sep 11, 2025
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 Zip을 이용해서 풀어봤는데..
재현님이 푸신 코드가 시간이 덜 걸리네요!
그냥 zip은 입력받은 리스트 같은 위치를 모아주는데 짧은 길이 리스트 기준입니다!
a = [1, 2, 3]
b = [4, 5]
c = [6, 7, 6]
zip(a, b, c) -> [(1, 4, 6), (2, 5, 6)]

zip_longest는 긴 리스트 기준으로 해줘요. 그럼 b[2]는 없으니까 None으로 채워줍니다.
zip_longest(a, b, c) -> [(1, 4, 6), (2, 5, 6), (3, None, 6)]

chars는 위 결과의 원소가 되고 붙여주려고 join을 사용했는데 None은 빼고싶어서 filter를 사용했어요.

Copy link
Contributor

@INSEA-99 INSEA-99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 Zip을 이용해서 풀어봤는데..
재현님이 푸신 코드가 시간이 덜 걸리네요!
그냥 zip은 입력받은 리스트 같은 위치를 모아주는데 짧은 길이 리스트 기준입니다!
a = [1, 2, 3]
b = [4, 5]
c = [6, 7, 6]
zip(a, b, c) -> [(1, 4, 6), (2, 5, 6)]

zip_longest는 긴 리스트 기준으로 해줘요. 그럼 b[2]는 없으니까 None으로 채워줍니다.
zip_longest(a, b, c) -> [(1, 4, 6), (2, 5, 6), (3, None, 6)]

chars는 위 결과의 원소가 되고 붙여주려고 join을 사용했는데 None은 빼고싶어서 filter를 사용했어요.

@jaykxo jaykxo merged commit 2f6b006 into main Sep 30, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants