
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
242 Views
When it is required to sort matrix based upon sum of rows, a method is defined that uses ‘sum’ method to determine the result.Below is a demonstration of the same −Example Live Demodef sort_sum(row): return sum(row) my_list = [[34, 51], [32, 15, 67], [12, 41], [54, 36, 22]] ... Read More

AmitDiwan
200 Views
When it is required to sort by maximum digit in element, a method is defined that uses ‘str’ and ‘max’ method to determine the result.Below is a demonstration of the same −Example Live Demodef max_digits(element): return max(str(element)) my_list = [224, 192, 145, 18, 3721] print("The list is :") ... Read More

AmitDiwan
360 Views
When it is required to calculate the percentage of positive elements of the list, a list comprehension and the ‘len’ method are used.Below is a demonstration of the same −Example Live Demomy_list = [14, 62, -22, 13, -87, 0, -21, 81, 29, 31] print("The list is :") print(my_list) my_result ... Read More

AmitDiwan
261 Views
When it is required to filter rows with range elements, a list comprehension and the ‘all’ operator is used to determine the output.Below is a demonstration of the same −Example Live Demomy_list = [[3, 2, 4, 5, 10], [32, 12, 4, 51, 10], [12, 53, 11], [2, 3, 31, 5, 8, ... Read More

AmitDiwan
275 Views
When it is required to sort strings by punctuation count, a method is defined that takes a string as a parameter and uses list comprehension and ‘in’ operator to determine the result.Below is a demonstration of the same −Example Live Demofrom string import punctuation def get_punctuation_count(my_str): return len([element for ... Read More

AmitDiwan
215 Views
When it is required to sort matrix by row median, a method is defined that uses the ‘median’ method to determine the result.Below is a demonstration of the same −Example Live Demofrom statistics import median def median_row(row): return median(row) my_list = [[43, 14, 27], [13, 27, 24], [32, ... Read More

AmitDiwan
927 Views
When it is required to display all the combinations of a dictionary list, a simple list comprehension and the ‘zip’ method along with the ‘product’ method are used.Below is a demonstration of the same −Example Live Demofrom itertools import product my_list_1 = ["python", "is", "fun"] my_list_2 = [24, 15] ... Read More

AmitDiwan
224 Views
When it is required to count average digits in a list, a simple iteration, the ‘str’ method and the ‘/’ operator is used.Below is a demonstration of the same −Example Live Demomy_list = [324, 5345, 243, 746, 432, 463, 946787] print("The list is :") print(my_list) sum_digits = 0 ... Read More

AmitDiwan
270 Views
When it is required to test string in character list and vice-versa, a simple ‘in’ operator and ‘join’ method are used.Below is a demonstration of the same −Example Live Demomy_string = 'python' print("The string is :") print(my_string) my_key = ['p', 'y', 't', 'h', 'o', 'n', 't', 'e', 's', 't'] ... Read More

AmitDiwan
183 Views
When it is required to test all even elements in the list for the given range, a simple iteration and the modulus operator is used.Below is a demonstration of the same −Example Live Demomy_list = [32, 12, 42, 61, 58, 60, 19, 16] print("The list is :") print(my_list) i, ... Read More