Files
freeCodeCamp/curriculum/challenges/japanese/23-python-for-everybody/python-for-everybody/iterations-loop-idioms.md
freeCodeCamp's Camper Bot 9c20069eb2 chore(i18n,learn): processed translations (#53819)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
2024-03-12 22:29:52 +05:30

780 B

id, title, challengeType, videoId, bilibiliIds, dashedName
id title challengeType videoId bilibiliIds dashedName
5e7b9f070b6c005b0e76f05e 繰り返し: ループの用法 11 AelGAcoMXbI
aid bvid cid
334491369 BV1tw411R7Mm 376530765
iterations-loop-idioms

--question--

--text--

次のコードでは、値のリストから最小値を見つけようとしています。 この中の 1 行に誤りがあり、コードが期待どおりに動作しません。 どの行ですか?

smallest = None
print("Before:", smallest)
for itervar in [3, 41, 12, 9, 74, 15]:
    if smallest is None or itervar < smallest:
        smallest = itervar
        break
    print("Loop:", itervar, smallest)
print("Smallest:", smallest)

--answers--

3


4


6


7

--video-solution--

3