Skip to content

Tag: list

Operand error when using an integer in a list

I’ve been trying to work on this code for hours but keep getting to the same point every time. Basically I’m trying to add up all the values in an array. However, it keeps saying unsupported operand for integer and list. I’m confused why it is saying that because the list consists of integer…

Best way to get element in list

I’m wondering what is the best way to return specific element in list based on specific condition, we can assume that there is always one and only one element that satisfy that condition. Example : The previous snip of code works, but i don’t really like access to result with [0] on the final list…

resolve matrix lists with lambda and map

we have 3 lists in below so , how we can sum all of similar index in lists together? i mean is 2 and 5 and 8 be sum together & 3 and 6 and 9 also be sum together & 4 and 7 and 10 as well ? but just use lambda and map… actually i have no idea