Python- Calling elements from a list returns wrong ones -


from list, shuffle:

rotationspeedarray = [4,6,8,10] #in hz random.shuffle(rotationspeedarray) 

i try call 1 specific number @ time,

print rotationspeedarray[0] print rotationspeedarray[1] print rotationspeedarray[2] print rotationspeedarray[3] 

but whenever this:

#an actual empty space [ 6 , 

the code part meant draw figure , rotate it. want different speeds, that's why created list takes 1 of rotation speeds , uses it. figure moves each trial @ different speed, process of taking 1 value @ time works. don't why whenever ask show me each value of list, this.

i hope sufficiently clear; please don't hesitate asking me question.

i'm having no problems. sure you're not surrounding converting list string somewhere down line?? it's treating rotationspeedarray string, why ask.

random.shuffle throw typeerror if had put quotes around list, i'm assuming there code you're not showing somewhere past converting string?

import random rotationspeedarray = [4,6,8,10] #in hz random.shuffle(rotationspeedarray)  # problem happening here   print(rotationspeedarray[0]) print(rotationspeedarray[1]) print(rotationspeedarray[2]) print(rotationspeedarray[3])  print(rotationspeedarray)  # demonstrate particular issue, if convert list string # same problem you're having stringarray = str(rotationspeedarray)  print(stringarray[0]) print(stringarray[1]) print(stringarray[2]) print(stringarray[3])  print(stringarray) 

output:

10 6 4 8 [10, 6, 4, 8] [ 1 0 , [10, 6, 4, 8] 

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -