+ 16
It says the answer is 4, but if nums=list (range (5)) then if I print (nums) I should see 0,1,2,3,4. and if I then print nums but indexing 4 it should be printing 3. what am I missing?
12 ответов
+ 8
indexing is start from 0 not 1
+ 8
But in the explanation there is an example: range(10) gives [0,1,2...,8,9]. That is, 10 figures. So range(5) should result in [0,1,2,3,4], isn'it?
+ 4
It goes from zero to 5, not 4. So there are 6 numbers in the list. It is therefore confusing. So, the list created is - [0,1,2,3,4,5]. Other confusing part is that it doesn't ask for 4th number in the list, which would be - 3, but rather 4th index. In this case 4th index is 5th element in the list, number 4. All the confusion stems from the fact that Python indexing begins with zero.
+ 1
yes as by example answer should be 3
+ 1
The range function lists numbers [0,1,2,3,4] and assigns it to 'list'. When list[4] is printed, indexing starts from 0 and hence 4th element is the '3'. and not '4'. It's not taking it as the answer. Am I missing something?
+ 1
list1 = range(5) is [0,1,2,3,4] and list2 = range(10) is [0,1,2,3,4,5,6,7,8,9] according to the provided example. So, why does list1 index[4] not result in the answer 3?
+ 1
0th index iz zero, 1st index is 1, 2nd index is 2... and goes on. so answer is 4. you can try it. define a list and print
0
I've got the same question. in my opinion the output for this example would be 3 according to the examples provided
0
I think it should be 3 the right answer.
0
it is right when it's says 4 for the index it calls variables 0-4 which is 4
0
hasil nya 2 bro
0
I'm not sure, but the count of the function always starts at 0, but the lists start at 1 or at 0, for this case it started at 0, but in the previous quiz it started at 1, so our count was subtracted 1 with respect to the list