{"id":16372,"date":"2021-08-12T09:37:38","date_gmt":"2021-08-12T04:07:38","guid":{"rendered":"https:\/\/python-programs.com\/?p=16372"},"modified":"2021-11-22T18:38:25","modified_gmt":"2021-11-22T13:08:25","slug":"python-program-to-count-the-number-of-null-elements-in-a-list","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-count-the-number-of-null-elements-in-a-list\/","title":{"rendered":"Python Program to Count the Number of Null elements in a List"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Convert Binary to Octal using While Loop<\/a>
\nPython lists are similar to arrays in C or Java. A list is a collection of elements.
\nThe primary distinction between a list and an array is that a list can store multiple types of elements, whereas an array can only store one type.<\/p>\n

A list can contain \u201cnull elements\u201d in addition to numbers, characters, strings, and so on.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given List =[\"btechgeeks\",\"hello\", \"\", 123, \"\" ]<\/pre>\n

Output:<\/strong><\/p>\n

The Number of Null Elements in the above given list =  2<\/pre>\n

Example 2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given List =[\"\", \"btechgeeks\", \"good \", \"\",\u00a0 \"hello\",\u00a0 \"\",\u00a0 \"\",1,2,9 ]<\/pre>\n

Output:<\/strong><\/p>\n

The Number of Null Elements in the above given list =  4<\/pre>\n

Program to Count the Number of Null elements in a List<\/h2>\n

Below are the ways to Count the Number of Null elements in a given list.<\/p>\n