ItSolutionStuff.com

How to Create List of Numbers from Range in Python?

By Hardik Savani • October 30, 2023
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:

main.py

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

Output:

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

Example 2:

main.py

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

Output:

[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: Python
Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

How to Remove All Numbers Values from List in Python?

Read Now →

How to Get Only String from a List in Python?

Read Now →

How to Get Only Numbers from a List in Python?

Read Now →

How to Get Only Negative Values in Python List?

Read Now →

How to Get Only Positive Values in Python List?

Read Now →

Python List Get All Items Less Than Some Value Example

Read Now →

Python List Get All Elements Greater Than Some Value Example

Read Now →

How to Reverse List Elements in Python?

Read Now →

How to Add Element at Specific Index in Python List?

Read Now →

Python List Print All Elements Except Last Example

Read Now →

How to Get Min Value from Python List?

Read Now →

How to Convert List to Lowercase in Python?

Read Now →

Python Get Second Last Element of List Example

Read Now →