-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#14 : Week3_예원이티
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import sys | ||
|
||
n = int(sys.stdin.readline()) | ||
|
||
guitar = [] | ||
|
||
for _ in range(n): | ||
guitar.append(sys.stdin.readline().strip()) | ||
|
||
def serialSum(str): | ||
sum = 0 | ||
for i in str: | ||
if i.isdigit(): | ||
This comment has been minimized.
Sorry, something went wrong. |
||
sum += int(i) | ||
return sum | ||
|
||
guitar.sort(key = lambda x : (len(x), serialSum(x), x)) | ||
|
||
for a in guitar: | ||
print(a) |
1 comment
on commit 2c30414
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저번에 배웠던 lamda. sort 함수와 문자열이 숫자로 이루어졌는지 아닌지를 판단하기 위한 isdigit 함수를 사용하여 문제를 아주 잘 풀어주셨습니다! 고생하셨습니다 💯