
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
5K+ Views
When it is required to find the most frequent word in a list of strings, the list is iterated over and the ‘max’ method is used to get the count of the highest string.ExampleBelow is a demonstration of the samefrom collections import defaultdict my_list = ["python is best for coders", ... Read More

AmitDiwan
237 Views
When it is required to get the maximum of each key in a list of dictionary elements, a simple iteration is used.ExampleBelow is a demonstration of the samemy_list = [{"Hi": 18, "there": 13, "Will": 89}, {"Hi": 53, "there": 190, "Will": 87}] print("The list is : ") ... Read More

AmitDiwan
170 Views
When it is required to count the pairs of reverse strings, a simple iteration is used.ExampleBelow is a demonstration of the samemy_list = [{"Python": 8, "is": 1, "fun": 9}, {"Python": 2, "is": 9, "fun": 1}, {"Python": 5, "is": 10, "fun": 7}] print("The list is :") print(my_list) result = ... Read More

AmitDiwan
1K+ Views
At first, let us create a Nested Dictionary −dictNested = {'Cricket': {'Boards': ['BCCI', 'CA', 'ECB'], 'Country': ['India', 'Australia', 'England']}, 'Football': {'Boards': ['TFA', 'TCSA', 'GFA'], 'Country': ['England', 'Canada', 'Germany'] }}Now, create an Empty Dictionary −new_dict = {}Now, loop to assign values −for outerKey, innerDict in dictNested.items(): ... Read More

AmitDiwan
328 Views
When it is required to print the elements which are multiples of elements given in a list, a list comprehension is used.ExampleBelow is a demonstration of the samemy_list = [45, 67, 89, 90, 10, 98, 10, 12, 23] print("The list is :") print(my_list) my_division_list = [6, 4] print("The ... Read More

AmitDiwan
404 Views
When it is required to print strings based on the list of prefix elements, a list comprehension, the ‘any’ operator and the ‘startswith’ method are used.ExampleBelow is a demonstration of the samemy_list = ["streek", "greet", "meet", "leeks", "mean"] print("The list is : ") print(my_list) prefix_list = ["st", "ge", ... Read More

AmitDiwan
162 Views
When it is required to remove row with custom list element, a list comprehension and the ‘any’ operator are used.ExampleBelow is a demonstration of the samemy_list = [[14, 3, 11], [66, 27, 8], [31, 12, 21], [11, 16, 26]] print("The list is :") print(my_list) check_list = [3, 10, ... Read More

AmitDiwan
262 Views
When it is required to remove duplicate elements index from other list, the ‘enumerate’ attribute, the list comprehension and a simple iteration are used.ExampleBelow is a demonstration of the samemy_list_1 = [4, 5, 6, 5, 4, 7, 8, 6] my_list_2 = [1, 7, 6, 4, 7, 9, 10, 11] ... Read More

AmitDiwan
536 Views
When it is required to remove specific digit from every element of the list, an iteration and ‘set’ operator and ‘str’ methods are used.ExampleBelow is a demonstration of the samemy_list = [123, 565, 1948, 334, 4598] print("The list is :") print(my_list) key = 3 print("The key is :") ... Read More

AmitDiwan
974 Views
To display only the column names in a DataFrame, use dataframe.columns.Import the required library with an alias −import pandas as pd;Following is the DataFrame −dataFrame = pd.DataFrame( { "Car": ['BMW', 'Audi', 'BMW', 'Lexus', 'Tesla', 'Lexus', 'Mustang'], "Place": ['Delhi', 'Bangalore', 'Hyderabad', 'Chandigarh', 'Pune', 'Mumbai', 'Jaipur'], "Units": [100, ... Read More