title: python - IndexError: index 9 is out of bounds for axis 0 with size 1
body: <p>I'm trying to run the following code. Unfortunately, I get an error that I'm not able to solve myself yet.</p>
  <pre><code>import numpy as np
  import random
  
  def reallyrandom(arg1, arg2, arg3):
      
      int1=int(arg1)
      int2=int(arg2)
      int3=int(arg3)
  
      np.random.seed(42)
  
      x=np.random.randint(0,10, size=int1)
      print(x)
      print(x.shape)
      y=x*int2
      print(y)
      print(y.shape)
      z=y[int3]
      print(z)
      
  
      print(f&quot;Your random value is {z}&quot;)
  
  reallyrandom(1,2,9)
  </code></pre>
  <p>Error:</p>
  <pre><code>IndexError                                Traceback (most recent call last)
  ~\AppData\Local\Temp/ipykernel_15232/4039400629.py in &lt;module&gt;
       23 
       24 #reallyrandom(59,2,7)
  ---&gt; 25 reallyrandom(1,2,9)
  
  ~\AppData\Local\Temp/ipykernel_15232/4039400629.py in reallyrandom(arg1, arg2, arg3)
       16     print(y)
       17     print(y.shape)
  ---&gt; 18     z=y[int3]
       19     #print(z)
       20 
  
  IndexError: index 9 is out of bounds for axis 0 with size 1
  </code></pre>
  <p>The problem seems to start in defining value z in <code>line z=y[int3]</code>
  I have no idea how to solve it. Could someone explain what I'm doing wrong?
  I found on the internet that it is an index error?</p>
  <p>Thank you in advance!</p>