Skip to content

Tag: list

Why is it saying my variable is not subscriptable?

I sometimes get this error (TypeError: ‘NoneType’ object is not subscriptable) when I call getLink()[0], and I sometimes don’t. Does anyone know why I’m getting this error? getLink() should be subscriptable… EDIT: my issue was I needed a longer time.sleep() waiting function to gi…

list comprehension, how to append the new elements to the list?

am working on my Python assessment and I need a hand :( so, the task is to use this equation: 10*x-5 and print positive numbers only; the task focuses on using list comprehension, finally, I’ve to print the updated list. I did all of that but i couldn’t figure out how to insert/append the updated …

python: split a list of strings based on a condition

I have a list like the following: I would like to split the list in a way to get the following output. I have tried the following but do not get the result i am looking for. Answer Almost. First of all, the following produces what you want – More specifically, it seems you want to split by a space-chara…