How to Create List of Numbers from Range in Python?

By Hardik Savani October 30, 2023 Category : Python

Hey Guys,

Here, I will show you python create list range of numbers. I am going to show you about create list of numbers python range. I explained simply step by step how to create list from range in python. I would like to share with you python create list of numbers from range. Let's get started with python list range of numbers example.

If you are looking to generate list of numbers from a given range in python, there are several ways to create a list from a range in python. here, I will give you two examples with range() and numpy library for creating new list numbers from range in python. so, let's see the example code.

You can use these examples with python3 (Python 3) version.

let's see below a simple example with output:

Example 1:

# python create list range of numbers
myList = list(range(10, 16))


[10, 11, 12, 13, 14, 15]

Example 2:

import numpy as np
# python create list of numbers from range
myList = np.arange(10, 16, 0.5).tolist()


[10.0, 10.5, 11.0, 11.5, 12.0, 12.5, 13.0, 13.5, 14.0, 14.5, 15.0, 15.5]

I hope it can help you...

Tags :