트인 경우에도 가장 작은 값으로 설정된 값을 반환하므로 여전히 결함이 있다. 이제 이 결함을
수정해보자.
TIP
파이썬에서
range
(
x
,
y
)
문은
x
에서
y
까지
1
씩 커지는 정수를 생성하되
y
는 포함하지 않는다. 또한
range
(
x
,
y
, -
1
)
은
x
에서
y
까지
1
씩 작아지는 정수를 생성하되, 마찬가지로
y
는 포함하지 않는다. 따라서
list
(
range
(
1
,
7
))
은
[
1
,
2
,
3
,
4
,
5
,
6
]
을,
list
(
range
(
5
,
0
,-
1
))
은
[
5
,
4
,
3
,
2
,
1
]
을 생성한다.
list
(
range
(
1
,
10
,
2
))
와 같이 값들 간의 차이를
2
로 주어
[
1
,
3
,
5
,
7
,
9
]
를 생성할 수도 있다.
1.3
주요 연산 횟수 계산하기
이제 수정된 코드를 보자. 가장 큰 값은 실제로 반드시
A
에 포함되어 있으므로 [코드
1
-
2
]에서
수정된
largest
()
함수는
may
_
max
값으로
A
의 첫 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.