
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
AmitDiwan has Published 10744 Articles

AmitDiwan
234 Views
When it is required to extract list with difference in extreme values greater than K, a list comprehension and the ‘min’ and ‘max’ methods are used.Below is a demonstration of the same −Example Live Demomy_list = [[13, 52, 11], [94, 12, 21], [23, 45, 23], [11, 16, 21]] print("The list ... Read More

AmitDiwan
1K+ Views
When it is required to get the negative index of an element in a list, the ‘len’ method and the ‘index’ method are used.Below is a demonstration of the same −Example Live Demomy_list = [52, 47, 18, 22, 23, 57, 13] print("The list is :") print(my_list) my_key = 22 ... Read More

AmitDiwan
481 Views
When it is required to customize the lower bound on a list, a list comprehension can be used and a specific condition can be placed in it.Below is a demonstration of the same −Example Live Demomy_list = [51, 71, 86, 21, 11, 35, 67] print("The list is :") print(my_list) ... Read More

AmitDiwan
173 Views
When it is required to remove elements, which are at K distance with N, a list comprehension along with a specific condition is used.Below is a demonstration of the same −Example Live Demomy_list = [13, 52, 5, 45, 65, 61, 18 ] print("The list is :") print(my_list) K = ... Read More

AmitDiwan
229 Views
When it is required to find disjoint strings across lists, a method is defined that takes two parameters, and uses the lambda and reduce methods with the ‘if’ condition to determine the result.Below is a demonstration of the same −Example Live Demofrom functools import reduce def determine_disjoint_pairs(disjoint_data, my_result=[]): ... Read More

AmitDiwan
183 Views
When it is required to check if particular value is present corresponding to a key ‘K’, a list comprehension is used.Below is a demonstration of the same −Example Live Demomy_list = [{"python" : "14", "is" : "great", "fun" : "1`"}, {"python" : "cool", "is" : "fun", "best" : "81"}, {"python" : ... Read More

AmitDiwan
312 Views
When it is required to sort the elements of the list by frequency of uppercase elements, a method is defined that uses list comprehension and the ‘isupper’ method.Below is a demonstration of the same −Example Live Demodef higher_character_sort(sub): return len([ele for ele in sub if ele.isupper()]) my_list = ["pyt", ... Read More

AmitDiwan
687 Views
When it is required to extract only the numbers from a list which have some specific digits, a list comprehension and the ‘all’ operator is used.Below is a demonstration of the same −Example Live Demomy_list = [3345, 2345, 1698, 2475, 1932] print("The list is :") print(my_list) digit_list = [2, ... Read More

AmitDiwan
231 Views
When it is required to sort a list of dictionaries based on the sum of their values, a method is defined that uses the ‘sum’ method to determine the result.Below is a demonstration of the same −Example Live Demodef sum_value(row): return sum(list(row.values())) my_dict = [{21 : 13, 44 : ... Read More

AmitDiwan
271 Views
When it is required to remove dictionaries with matching values, a dictionary comprehension is used.Below is a demonstration of the same −Example Live Demomy_dict_1 = [{'Hi': 32, "there": 32, "Will":19}, {'Hi': 19, "there": 100, "Will": 13}, {'Hi': 72, "there": 19, "Will": 72}] print("The first dictionary is : ") print(my_dict_1) ... Read More