
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
195 Views
When it is required to find the largest value in a tree using in order traversal, a binary tree class is created with methods to set the root element, perform in order traversal using recursion and so on.An instance of the class is created, and it can be used to ... Read More

AmitDiwan
1K+ Views
When it is required to calculate the number of words and characters present in a string, Below is the demonstration of the sameExample Live Demomy_string = "Hi there, how are you Will ? " print("The string is :") print(my_string) my_chars=0 my_words=1 for i in my_string: my_chars=my_chars+1 if(i==' '): ... Read More

AmitDiwan
668 Views
When it is required to remove characters from odd indices of a string, a method is defined that takes the string as parameter.Below is the demonstration of the same −Example Live Demodef remove_odd_index_characters(my_str): new_string = "" i = 0 while i < len(my_str): if (i ... Read More

AmitDiwan
405 Views
When it is required to perform depth first search on a tree using recursion, a class is defined, and methods are defined on it that help perform breadth first search.Below is a demonstration for the same −Example Live Democlass BinaryTree_struct: def __init__(self, key=None): self.key = key ... Read More

AmitDiwan
783 Views
When it is required to sort a binary search tree, a class is created, and methods are defined inside it that perform operations like inserting an element, and performing inorder traversal.Below is a demonstration of the same −Exampleclass BinSearchTreeNode: def __init__(self, key): self.key = key ... Read More

AmitDiwan
428 Views
When it is required to concatenate a matrix vertically, the list comprehension can be used.Below is a demonstration of the same −Example Live Demofrom itertools import zip_longest my_list = [["Hi", "Rob"], ["how", "are"], ["you"]] print("The list is : ") print(my_list) my_result = ["".join(elem) for elem in zip_longest(*my_list, fillvalue ... Read More

AmitDiwan
413 Views
When it is required to get the ‘n’th column of a matrix, the ‘any’ method can be used.Below is a demonstration of the same −Example Live Demomy_list = [[34, 67, 89], [16, 27, 86], [48, 30, 0]] print("The list is : ") print(my_list) N = 1 print("The value of ... Read More

AmitDiwan
663 Views
When it is required to create a matrix of dimension n * n, a list comprehension is used.Below is a demonstration of the same −Example Live DemoN = 4 print("The value of N is ") print(N) my_result = [list(range(1 + N * i, 1 + N * (i + 1))) ... Read More

AmitDiwan
3K+ Views
When it is required to read the height in ‘cm’ and convert it into ‘feet’ and ‘inches’, the ‘round’ method can be used.Below is a demonstration of the same −Example Live Demoin_cm=int(input("Enter the height in centimeters...")) in_inches=0.394*in_cm in_feet=0.0328*in_cm print("The length in inches is ") print(round(in_inches, 2)) print("The length in feet is") ... Read More

AmitDiwan
335 Views
When it is required to compute a simple interest when the amount, rate and interest are given, a simple formula can be defined, and the elements can be plugged into the formula.Below is a demonstration of the same −Example Live Demoprinciple_amt = float(input("Enter the principle amount...")) my_time = int(input("Enter the time ... Read More