+ 1

[Solved] Why is there an error, and how do I fix it?

skills_list_1 = ["Lightning","Mind Control","Telekinesis","Mind Reading","Super Speed"] magic_skill_1 = skills_list_1(2) print(magic_skill_1) It says "list" object could not be called, why?

20th Jun 2022, 11:22 PM
MyNameIsNotBob
MyNameIsNotBob - avatar
1 ответ
+ 6
If you want to get an element of a list, you enclose the index with [] instead of () In this case that line 2 should be changed to: magic_skill_1 = skill_list_1[2] The error message happens because a list object isn't callable. An example of a callable object is a function, which you know because you use () to provide parameters.
21st Jun 2022, 12:13 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar