-
Notifications
You must be signed in to change notification settings - Fork 0
built in function
PingpingPapa edited this page Feb 10, 2022
·
3 revisions
result = sum([1, 2, 3, 4, 5])
print(result)
# 15
result = min(7, 3, 2, 1)
print(result)
# 1
문자열 형태의 수학 수식을 계산
result = eval("(3+5)*7")
print(result)
# 56
result = sorted([9, 1, 8, 5, 4])
print(result)
# 오름차순 정렬: 1 4 5 8 9
result = sorted([9, 1, 8, 5, 4], reverse = True)
print(result)
# 내림차순 정렬: 9 8 5 4 1
result = sorted([('홍길동', 35), ('이순신', 75), ('아무개', 50)], key = lambda x: x[1], reverse = True)
print(result)
# [('이순신', 75), ('아무개', 50), ('홍길동', 35)]