• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Getting errors when computing the length of list of lists

Resolved: Getting errors when computing the length of list of lists

0
By Isaac Tonny on 16/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I have a list of lists. I am trying to find the indices of lists whose length is 4. Here is the code:
Alongside the correct indices, I also get the index of a list whose length is 1. Is there something wrong in my code? I have no idea why this happens.

Answer:

When you iterate over list_of_lists like so, j is the inner list, so you need to check whether len(j) == 4:

If you have better answer, please add a comment about this, thank you!

python
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Pandas Groupby Get Values from Previous Group

24/03/2023

Resolved: Can’t access static methods from outside until JavaScript’s static block is over?

24/03/2023

Resolved: Count number on values (which are measure) in a table

24/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.