0

What is the difference between a array and a list how are they written

arrays are faster for math but can they contain var is ("maybe", "fun", "better") and so on do you use () or []

29th Jul 2017, 5:51 PM
Lloyd
9 Antworten
+ 1
The array is in fact a list where every item has an index. var a=new Array(); //this is one way to declare an Array var b=[];//this is another way to declare an array if you want to fill an array, you specify the index first: b[0]=1; b[1]=2; b[2]=3;//and so on.. Rememb that the index count starts at 0
29th Jul 2017, 6:08 PM
Mane Antonio
Mane Antonio - avatar
0
not working, I need to write an array with words and than loop it. I have tried from array import array and went on. the result was that it could not be scripted.
29th Jul 2017, 11:49 PM
Lloyd
29th Jul 2017, 11:54 PM
Mane Antonio
Mane Antonio - avatar
0
from array import array my array = [1, 'Sunday', 'Monday' etc....] print (1) ..... now I need to loop it
29th Jul 2017, 11:59 PM
Lloyd
0
so, you want to print the content with a loop
30th Jul 2017, 12:00 AM
Mane Antonio
Mane Antonio - avatar
0
yes Sir
30th Jul 2017, 12:01 AM
Lloyd
0
i'll send you a code with comments
30th Jul 2017, 12:02 AM
Mane Antonio
Mane Antonio - avatar
0
ty
30th Jul 2017, 12:02 AM
Lloyd
30th Jul 2017, 12:28 AM
Mane Antonio
Mane Antonio - avatar