-2

I am trying to create a list of size 9 (but that can change) which is populated with numbers from the range of [-pi/2,pi/2] where basically the range is split into 9 numbers and those 9 numbers are what the list is populated with.

tethys4
  • 55
  • 1
  • 11

2 Answers2

0

try:

numpy.linspace(-pi/2,pi/2,9)

Goes from -pi/2 to pi/2 in 9 steps

savvamadar
  • 306
  • 2
  • 13
0
import math
import numpy as np

liste=np.arange(-math.pi/2, math.pi/2+0.01, math.pi/8)
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Menroka
  • 19
  • 5
  • 1
    Code-only answers are discouraged. Please click on [edit] and add some words summarising how your code addresses the question, or perhaps explain how your answer differs from the previous answer/answers. [From Review](https://stackoverflow.com/review/low-quality-posts/22328139) – Nick Feb 28 '19 at 00:37
  • 1
    The superficiality of the review comments bugs me. That said, you should display `liste`. Other answers and comments use `linspace`. It handles the end point better. – hpaulj Feb 28 '19 at 05:00