<Python 문법>max와 index구하기:max 함수와 index 메소드

박서연·2023년 2월 8일
0

CodingTest

목록 보기
1/17

백준#2562

1. 리스트 최대,최소함수

max(), min()를 이용해 리스트 내 최대값과 최소값을 구함

lst = [1, 2, 3, 4, 5]
max(lst)
min(lst)

2. index 메소드

lst = [1, 2, 3, 4, 5]
lst.index(1)	#lst 내의 원소 중 1에 해당하는 index 찾음

0개의 댓글