Better Programming

Advice for programmers.

Follow publication

Member-only story

10 Important Tips for Using Nested Lists in Python

Indhumathy Chelliah
Better Programming
Published in
4 min readSep 15, 2021

--

Photo by Magda Ehlers from Pexels

1. How to check if an element is present in a nested list?

Using any() function

any(elem in sub_list for sub_list in nested_list)

2. How to reverse the nested list?

Using indexing

Using reverse()

How to reverse the elements in the sub-list?

--

--

Indhumathy Chelliah
Indhumathy Chelliah

Written by Indhumathy Chelliah

Machine Learning | Python |R | Tableau | 1.5 M Views

No responses yet

Write a response