How to generate a sequence of numbers in Python
Land Your First Data Science Job
A proven roadmap to prepare for $75K+ entry-level data roles. Perfect for Data Scientist ready to level up their career.
It is often useful to have a sequence of numbers in Python.
Using the built-in range() method your can generate a sequence of numbers.
It is often used with loops like that :
Adding steps
You can also add a step value, so that it doesn't increment by one but by the step value.
Here is an example
Here you are ! You now know how to generate a sequence of numbers in Python !
Land Your First Data Science Job
A proven roadmap to prepare for $75K+ entry-level data roles. Perfect for Data Scientist ready to level up their career.
Related Articles
Continue your learning journey with these related topics
Master Data Science in Days, Not Months 🚀
Skip the theoretical rabbit holes. Get practical data science skills delivered in bite-sized lessons – Approach used by real data scientist. Not bookworms. 📚