+ 2
list(range(3,8)) produces an output from [3,4,5,6,7] why not upto 8?
7 odpowiedzi
+ 5
You can understand easily: range takes an argument (number 8, for example) as the length. So you have: 0, 1, 2, 3, 4, 5, 6 and 7.
But when you specify another argument, before the previous one, Python expects your starting point. In that particular case number 3. Thus when you print again you're just hiding numbers 0, 1 and 2.
Hope it develops your understanding.
+ 2
the range function works from a number (mostly 0) TO the end wich means excluding the last number
+ 2
in the comand of range (3,8) means between 3 to 8 . thats why your output comes 3,4,5,6,7 .
0
in a scientific collection range the threshold is displayed but not the upper limit that's why so
0
the threshold of every counting is zero but can u tell the ending of a counting. u can't imagine even then why so computer
- 1
can u plzz explain
- 1
sharma hope u got the answer