Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок+ 1
Can you determine the largest integer printed using the for loop.. i.e. when it goes lo infinte loop.. what will be the max int?
Maximum integer using iteration..
1 ответ
+ 3
Using the for loop, the largest integer printed depends on what object used in a loop.
for i in range(10): #9 will be the largest number
for i in [i for i in range(6)][::-1]:
#Demonstrated as [5,4,3,2,1,0]
#5 will be the largest number.
When it goes to the "infinite" loop, as it never stops, it is impossible to print the largest number UNLESS you do sth like
for i in [4,4,4,4,...]
Where 4 is the largest number.