
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
719 Views
ProblemWe are required to write a JavaScript function that takes in one positive three-digit integer and rearranges its digits to get the maximum possible number.ExampleFollowing is the code − Live Democonst num = 149; const maxRedigit = function(num) { if(num < 100 || num > 999) return ... Read More

AmitDiwan
345 Views
When it is required to check if the frequency of a dictionary, set and counter are same, the Counter package is imported and the input is converted into a ‘Counter’. The values of a dictionary are converted to a ‘set’ and then to a list. Based on the length of ... Read More

AmitDiwan
313 Views
When it is required to demonstrate a counter and dictionary intersection, the Counter and dictionary can be used.Below is the demonstration of the same −Example Live Demofrom collections import Counter def make_string(str_1, str_2): dict_one = Counter(str_1) dict_two = Counter(str_2) result = dict_one & dict_two return ... Read More

AmitDiwan
1K+ Views
When it is required to create a dictionary where keys have multiple inputs, an empty dictionary can be created, and the value for a specific key can be specified.Below is the demonstration of the same −Example Live Demomy_dict = {} a, b, c = 15, 26, 38 my_dict[a, b, c] ... Read More

AmitDiwan
395 Views
ProblemWe are required to write a JavaScript function that takes in an array of strings. Our function should create combinations by combining all possible n consecutive strings in the array and return the longest such string that comes first.ExampleFollowing is the code − Live Democonst arr = ["zone", "abigail", "theta", "form", ... Read More

AmitDiwan
474 Views
When it is required to sort the key and values in a dictionary, the ‘sorted’ method can be used.Below is the demonstration of the same −Example Live Demomy_dict = {'Hi': [1, 6, 3], 'there': [2, 9, 6], 'Mark': [16, 7]} print("The dictionary is : ") print(my_dict) my_result ... Read More

AmitDiwan
220 Views
When it is required to sort the dictionaries in Python using a key or a value, a dictionary can be defined, and key value pairs can be inserted into it. A ‘for’ loop can be used to iterate through the key value pair, and sort it using ‘sort’ method. This ... Read More

AmitDiwan
703 Views
When it is required to check the order of the character in the string, the ‘OrderedDict’ method can be used.Below is the demonstration of the same −Example Live Demofrom collections import OrderedDict def check_order(my_input, my_pattern): my_dict = OrderedDict.fromkeys(my_input) pattern_length = 0 for key, value in my_dict.items(): ... Read More

AmitDiwan
529 Views
When it is required to insert the elements at the beginning of an ordered dictionary, the ‘update’ method can be used.Below is the demonstration of the same −Example Live Demofrom collections import OrderedDict my_ordered_dict = OrderedDict([('Will', '1'), ('James', '2'), ('Rob', '4')]) print("The dictionary is :") print(my_ordered_dict) my_ordered_dict.update({'Mark':'7'}) my_ordered_dict.move_to_end('Mark', last = ... Read More

AmitDiwan
697 Views
When it is required to sort the list of dictionary based on values, the itemgetter attribute can be used.Below is the demonstration of the same −Example Live Demofrom operator import itemgetter my_list = [{ "name" : "Will", "age" : 56}, ... Read More