0

What should be otput of this..it should be 3 or 4

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

14th Apr 2017, 2:52 PM
arun kumar
arun kumar - avatar
6 Answers
+ 1
The Answer your looking is 4
14th Apr 2017, 3:06 PM
Nihad TK
Nihad TK - avatar
+ 1
why can u please me it is from count starta from 0 so it should be 3
14th Apr 2017, 3:11 PM
arun kumar
arun kumar - avatar
+ 1
range(5) means 0 1 2 3 4 There Is No 5 in range(5)
14th Apr 2017, 3:15 PM
Nihad TK
Nihad TK - avatar
+ 1
@arun kumar In programming languages counting starts from 0 Not 1 example we usually count from 1 ,2 ,3 etc.. but in programming languages you start from 0, 1 , 2 ,3 etc...
14th Apr 2017, 3:25 PM
Nihad TK
Nihad TK - avatar
0
but m printing print(nums[4]) 0 1 2 3 4th is 3
14th Apr 2017, 3:18 PM
arun kumar
arun kumar - avatar
0
yup
16th Apr 2017, 9:48 AM
Mahadev Moger
Mahadev Moger - avatar