
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
188 Views
When it is required to extract ordered tuples, a list comprehension, the ‘sorted’ method, the ‘tuple’ method and the ‘==’ operator is used.ExampleBelow is a demonstration of the same −my_list = [(15, 74, 36, 22, 54), (13, 24, 56), (59, 60, 34), (42, 65, 56), (99, 91)] print("The list ... Read More

AmitDiwan
229 Views
When it is required to concatenate the rear elements in a tuple list, a list comprehension and the ‘join’ methods are used.ExampleBelow is a demonstration of the same −my_tuple = [(13, 42, "Will"), (48, "is a"), ("good boy", )] print("The tuple is : " ) print(my_tuple) my_result = ... Read More

AmitDiwan
181 Views
When it is required to find the ‘K’th even element in a list, a list comprehension and the ‘%’ operator is used.ExampleBelow is a demonstration of the same −my_list = [14, 63, 28, 32, 18, 99, 13, 61] print("The list is :") print(my_list) K = 3 print("The value ... Read More

AmitDiwan
178 Views
When it is required to split a list based on the next larger value, a list comprehension, the ‘iter’ method and the ‘islice’ methods are used.ExampleBelow is a demonstration of the same −from itertools import islice my_list = [11, 22, 33, 34, 45, 26, 87, 11] print("The list is ... Read More

AmitDiwan
576 Views
When it is required to extract element from ranges in a list, a simple iteration and the ‘extend’ method is used.ExampleBelow is a demonstration of the same −my_list = [14, 55, 41, 14, 17, 59, 22, 25, 14, 69, 42, 66, 99, 19] print("The list is :") print(my_list) ... Read More

AmitDiwan
444 Views
When it is required to find the fractional frequency of elements in a list, a dictionary comprehension, a simple iteration and the ‘Counter’ method is used.ExampleBelow is a demonstration of the same −from collections import Counter my_list = [14, 15, 42, 60, 75, 50, 45, 55, 14, 60, 48, ... Read More

AmitDiwan
383 Views
When it is required to concatenate tuple to a dictionary key, a list comprehension and the ‘join’ attribute are used.ExampleBelow is a demonstration of the same −my_list = [(("pyt", "is", "best"), 10), (("pyt", "cool"), 1), (("pyt", "is", "fun"), 15)] print("The list is :") print(my_list) my_result = {} for ... Read More

AmitDiwan
374 Views
When it is required to restrict elements frequency in a list, a simple iteration is used along with the ‘append’ method.ExampleBelow is a demonstration of the same −from collections import defaultdict my_list = [11, 14, 15, 14, 11, 14, 14, 15, 15, 16] print("The list is :") print(my_list) ... Read More

AmitDiwan
303 Views
When it is required to list elements grouping in a matrix, a simple iteration, the ‘pop’ method, list comprehension and ‘append’ methods are used.ExampleBelow is a demonstration of the same −my_list = [[14, 62], [51, 23], [12, 62], [78, 87], [41, 14]] print("The list is :") print(my_list) check_list ... Read More

AmitDiwan
251 Views
When it is required to convert tuple into list by adding the given string after every element, the list comprehension is used.ExampleBelow is a demonstration of the same −my_tuple = ((15, 16), (71), 42, 99) print("The tuple is :") print(my_tuple) K = "Pyt" print("The value of K is ... Read More