+ 1
Need help.
list= [0, 1.00794, 4.002602, 6.941, 9.012182, 10.811, 12.0107, 14.0067, 15.9994, 18.84032, 20.1797, 22.989770, 24.3050, 26.9815 38, 28.0855, 30.973761, 32.065, 35.153, 39.948, 39.0983, 40.078 ] print (list [2]) But I got error. Please tell me my mistakes. In phyton
9 Answers
+ 4
Oh, I just found the problem.
Okay, to start, completely disregard my previous comment, it was totally false (they can have multiple different data types stored within them).
If you look at the number beside 26.9815, it has no comma separating it (the number should be 38). If you either get rid of the whitespace between the 2 values or add a comma between them, it should work.
+ 2
also, shouldn't name your list "list"
+ 1
Thanks Bro
+ 1
But I have same error massage
+ 1
Yeah, after testing it I too am still getting an error.
+ 1
đ„đ„đ„
0
oops... đđđ
0
Yup...
- 3
In Python, lists must only contain one specific data type. Because you have 2 data types (int and float), the list becomes obsolete and therefore results in an error trying to use it.
What I would suggest is to change the first element to 0.0, so it follows the trend of floats and keeps the list the same throughout.