Skip to content

Commit

Permalink
#14 : 1431_시리얼 번호
Browse files Browse the repository at this point in the history
#14 : Week3_예원이티
  • Loading branch information
yewonahn authored May 4, 2023
1 parent 3902c53 commit 2c30414
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions 이티예원/1431_시리얼 번호.py
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.

Copy link
@plum-king

plum-king May 5, 2023

Contributor

저번에 배웠던 lamda. sort 함수와 문자열이 숫자로 이루어졌는지 아닌지를 판단하기 위한 isdigit 함수를 사용하여 문제를 아주 잘 풀어주셨습니다! 고생하셨습니다 💯

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

@yewonahn
Copy link
Contributor Author

Choose a reason for hiding this comment

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

1431

Please sign in to comment.