wrong answer in Python Tutorial "Range" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

wrong answer in Python Tutorial "Range"

So here's the question: What is the result of this code? nums = list(range(5)) print(nums[4]) My answer is 3 but the site says 4 is correct. I think it's WRONG. Simply because range will give you integers that starts at [0, 1, 2, 3, 4] What do you think?

6th Dec 2019, 11:54 AM
phen aguilar
phen aguilar - avatar
1 Answer
- 1
Don't you think if it was wrong then someone else would have brought that up before you did? Kindly learn the course in detail and do not miss these small concepts like 0 indexing.
6th Dec 2019, 12:12 PM
Avinesh
Avinesh - avatar