0

How to run a list of objects (python)

I have a tutorial code in the making, as I was testing some of the code, I came across this error. I stored 10 objects in a list, I then tried to loop through and run them all. How can I do this? I keep getting "indices must be integers or slices, not Thing" https://code.sololearn.com/cndn7I2RwlU4/?ref=app

23rd Jul 2020, 9:51 AM
Clueless Coder
Clueless Coder - avatar
2 odpowiedzi
+ 3
in your static method, hello needs to be a string. also, since youre in a loop, youve already acessed the list, no need for index https://code.sololearn.com/cH26EVnuNG7o/?ref=app
23rd Jul 2020, 10:01 AM
Slick
Slick - avatar
+ 2
Thanks so much Slick! I had no idea it wasn't a string the whole time!
23rd Jul 2020, 10:03 AM
Clueless Coder
Clueless Coder - avatar