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? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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..

13th Oct 2019, 9:17 AM
H.BHARAT CHANDRA
1 Answer
+ 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.
22nd Oct 2019, 11:18 AM
Name Omitted until I come back