﻿ NumPy: Create a 1-D array of 20 element spaced evenly on a log scale between 2. and 5., exclusive - w3resource # NumPy: Create a 1-D array of 20 element spaced evenly on a log scale between 2. and 5., exclusive

## NumPy: Array Object Exercise-46 with Solution

Write a NumPy program to create a 1-D array of 20 element spaced evenly on a log scale between 2. and 5., exclusive.

Sample Solution:-

Python Code:

``````import numpy as np
x =  np.logspace(2., 5., 20, endpoint=False)
print(x)
```
```

Sample Output:

```[   100.            141.25375446    199.5262315     281.83829313
398.10717055    562.34132519    794.32823472   1122.0184543
1584.89319246   2238.72113857   3162.27766017   4466.83592151
6309.5734448    8912.50938134  12589.25411794  17782.79410039
25118.8643151   35481.33892336  50118.72336273  70794.57843841]
```

Python Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

What is the difficulty level of this exercise?

Test your Python skills with w3resource's quiz

﻿

## Python: Tips of the Day

Set comprehension:

```>>> m = {x ** 2 for x in range(5)}
>>> m
{0, 1, 4, 9, 16}
```