
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
225 Views
When it is required to cross join every ‘K’th element, a method is defined that uses iteration and fetches the index as output.ExampleBelow is a demonstration of the same −def merge_pair_elem(my_list_1, my_list_2, K): index_1 = 0 index_2 = 0 while(index_1 < ... Read More

AmitDiwan
352 Views
When it is required to find the character position of ‘K’th word from a list of strings, a list comprehension along with enumerate is used.ExampleBelow is a demonstration of the same −my_list = ["python", "is", "fun", "to", "learn"] print("The list is :") print(my_list) K = 15 print("The value ... Read More

AmitDiwan
464 Views
When it is required to replace all characters of a list except a given character, a list comprehension, and the ‘==’ operator are used.ExampleBelow is a demonstration of the same −my_list = ['P', 'Y', 'T', 'H', 'O', 'N', 'P', 'H', 'P'] print("The list is :") print(my_list) replace_char = ... Read More

AmitDiwan
170 Views
When it is required to concatenate strings around ‘K’, a simple iteration and the ‘append’ method is used.ExampleBelow is a demonstration of the same −my_list = ["python", "+", 'is', 'fun', "+", 'to', 'learn'] print("The list is :") print(my_list) K = "+" print("The value of K is :") print(K) ... Read More

AmitDiwan
638 Views
When it is required to sum the consecutive numbers with overlapping elements in lists, a list comprehension, list slicing, concatenation operator and ‘zip’ methods are used.ExampleBelow is a demonstration of the same −my_list = [41, 27, 53, 12, 29, 32, 16] print("The list is :") print(my_list) my_result = ... Read More

AmitDiwan
251 Views
When it is required to get the indices of each element of one list in another list, a simple iteration and the enumerate attribute along with the ‘setdefault’ method is used.It also uses list comprehension and the ‘get’ method is used.ExampleBelow is a demonstration of the same −my_list = [14, ... Read More

AmitDiwan
277 Views
When it is required to remove rows with duplicate element in a matrix, a list comprehension and the ‘set’ operator is used.ExampleBelow is a demonstration of the same −my_list = [[34, 23, 34], [17, 46, 47], [22, 14, 22], [28, 91, 19]] print("The list is :") print(my_list) my_result ... Read More

AmitDiwan
820 Views
When it is required to extract keywords from a list, a simple iteration and the ‘iskeyword’ method is used.ExampleBelow is a demonstration of the same −import keyword my_list = ["python", 'is', 'fun', 'to', 'learn'] print("The list is :") print(my_list) my_result = [] for element in my_list: ... Read More

AmitDiwan
475 Views
When it is required to sort the strings based on a substring range, a method us defined that uses list slicing to determine the result.ExampleBelow is a demonstration of the same −def get_substring(my_string): return my_string[i : j] my_list = ["python", 'is', 'fun', 'to', 'learn'] print("The ... Read More

AmitDiwan
386 Views
When it is required to extract string elements from mixed matrix, a list comprehension and the ‘isinstance’ method is used.ExampleBelow is a demonstration of the same −my_list = [[35, 66, 31], ["python", 13, "is"], [15, "fun", 14]] print("The list is :") print(my_list) my_result = [element for index in ... Read More