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
369 Views
When it is required to extract particular data type rows, the list comprehension, the ‘isinstance’ method, and the ‘all’ operator are used.Below is a demonstration of the same −Example Live Demomy_list = [[14, 35, "Will"], [12, 26, 17], ["p", "y", "t"], [29, 40, 21]] print("The list is :") print(my_list) ... Read More
AmitDiwan
312 Views
When it is required to group consecutive elements by sign, the ‘^’ operator and the simple iteration along with ‘enumerate’ is used.Below is a demonstration of the same −Example Live Demomy_list = [15, -33, 12, 64, 36, -12, -31, -17, -49, 12, 43, 30, -23, -35, 53] print("The list is ... Read More
AmitDiwan
977 Views
When it is required to determine K middle elements, the ‘//’ operator and list slicing is used.Below is a demonstration of the same −Example Live Demomy_list = [34, 56, 12, 67, 88, 99, 0, 1, 21, 11] print("The list is : ") print(my_list) K = 5 print("The value of ... Read More
AmitDiwan
420 Views
When it is required to filter sorted rows, a list comprehension and the ‘sorted’ and ‘list’ methods are used.Below is a demonstration of the same −Example Live Demomy_list = [[99, 6, 75, 10], [1, 75, 2, 4, 99], [75, 15, 99, 2], [1, 4, 15, 99]] print("The list is :") ... Read More
AmitDiwan
160 Views
When it is required to sort a row by multiples of K, a method is defined that uses list comprehension and the modulus operator.Below is a demonstration of the same −Example Live Demodef multiple_sort_val(row): return len([ele for ele in row if ele % K == 0]) my_list = [[11, ... Read More
AmitDiwan
205 Views
When it is required to trim tuples based on a K value, a simple iteration and the ‘append’ method is used.Below is a demonstration of the same −Example Live Demomy_list = [(44, 3, 68, 11, 5), (68, 44, 9, 5, 8), (8, 11, 2, 68, 5), (44, 68, 2, 5, 7)] ... Read More
AmitDiwan
510 Views
When it is required to sort the list based on range, the ‘abs’ method, the ‘sum’ method and the list comprehension are used using a function.Below is a demonstration of the same −Example Live Demodef sum_range_incl(my_row): return sum([abs(element [1] - element [0]) for element in my_row if element [0] ... Read More
AmitDiwan
290 Views
When it is required to find the maximum value in a row range, a simple iteration and the ‘max’ method is used.Below is a demonstration of the same −Example Live Demomy_list = [[11, 35, 6], [9, 11, 3], [35, 4, 2], [8, 15, 35], [5, 9, 18], [5, 14, 2]] ... Read More
AmitDiwan
214 Views
When it is required to sort a matrix based on the number of elements that is greater than the previous element, a list comprehension and the ‘len’ method is used by using a function.Below is a demonstration of the same −Example Live Demodef fetch_greater_freq(row): return len([row[idx] for idx in ... Read More
AmitDiwan
344 Views
When it is required to filter strings within the ASCII range, the ‘ord’ method that helps with Unicode representation and the ‘all’ operator are used.Below is a demonstration of the same −Example Live Demomy_string = "Hope you are well" print("The string is :") print(my_string) my_result = all(ord(c) < 128 ... Read More