What is the difference between slice and range? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is the difference between slice and range?

12th Jul 2021, 5:49 AM
Pranjal Rastogi
Pranjal Rastogi - avatar
2 Answers
+ 4
The most common difference is, the range is iterable and the slice is not iterable. You can have a look at this article: https://til.hashrocket.com/posts/5zuzolqlcb-range-v-slice
12th Jul 2021, 6:28 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 2
Need to specify whether you are talking about A. the built-in function slice() or B. using slice notation
12th Jul 2021, 7:24 AM
David Ashton
David Ashton - avatar