How to Generate a Sequence of Numbers in Python

Let’s say you want to generate a sequence of numbers from 1 to 10 in Python. Here’s how:

x = range(1, 11) // it goes up to one less than the second parameter

Let’s say you want to generate a sequence from 0 to 10:

x = range(11) // default is to start at 0

Leave a Reply