0

numbers = list(range(5)) print(numbers[4])

why does the above code print 4 and not 3?

27th Sep 2018, 4:40 PM
Ajay B
1 Resposta
+ 1
counting starts at 0, just like range numbers = [0,1,2,3,4] numbers[0]=0 numbers[1]=1 ... numbers[4]=4
27th Sep 2018, 4:48 PM
davy hermans
davy hermans - avatar