+ 5

Python Range

If we want to start number range from 1 to n using Rang()....so is it possible?

26th Feb 2018, 2:25 PM
Shivani Goyal
2 Réponses
+ 3
range(1, n+1) will do it. You can even do range(-10, 11, 2) to get even numbers from -10 to 10 (step of 2.)
26th Feb 2018, 3:42 PM
John Wells
John Wells - avatar
0
Hmm.. range(1,lastNumberExcluded) ? btw why don't you try in playground first? It will be much faster than asking here.
26th Feb 2018, 3:44 PM
Sylar