• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
August 15, 2022 |4.1K Views
Python program to Check if a given object is list or not
Description
Discussion

In this video, we will write a python program to check if a given object is list or not

Below is the list of approaches that we will cover in this section: 

1. Using isinstance() 
2. Using type(x) 

Here we try to check how we can distinguish that our object is list or not & to check that we use 2 in-build function of Python that is isinstance() and type() method. 

The isinstance() takes two parameter and verify that is the given object is same to the 2nd parameter or not. The return type will be Boolean. 

type() method returns class type of the argument(object) passed as parameter. type() function is mostly used for debugging purposes.

Python | Check if a given object is list or not
https://www.geeksforgeeks.org/python-check-if-a-given-object-is-list-or-not/

Read More