AmitDiwan has Published 10744 Articles

Python program to Find the first non-repeating character from a stream of characters?

AmitDiwan

AmitDiwan

Updated on 11-Aug-2022 11:57:47

9K+ Views

In this article, we will find the first non-repeating character from a stream of character. Let’s say the following is our input − Thisisit The following should be our output displaying first non-repeating character − H Find the first non-repeating character from a stream of characters using while ... Read More

Swap two variables in one line in using Python?

AmitDiwan

AmitDiwan

Updated on 11-Aug-2022 11:50:04

3K+ Views

We will learn how to swap two variables in one line. Let’s say the following is our input − a = 10 b = 5 The following is our output after swap − a = 5 b = 10 Swap two variables in one line using comma operator ... Read More

Python program to print duplicates from a list of integers?

AmitDiwan

AmitDiwan

Updated on 11-Aug-2022 11:41:43

3K+ Views

We will display duplicates from a list of integers in this article. The list is can be written as a list of comma-separated values (items) between square brackets. Important thing about a list is that the items in a list need not be of the same type Let’s say we ... Read More

What is calendar module in python?

AmitDiwan

AmitDiwan

Updated on 11-Aug-2022 11:35:39

3K+ Views

The Calendar module in Python is used to display calendars and provides useful Built-in functions for displaying week, week day, month, month of the year, and other operations. By default, these calendars have Monday as the first day of the week, and Sunday as the last. Display the Calendar of ... Read More

Quickly convert Decimal to other bases in Python

AmitDiwan

AmitDiwan

Updated on 11-Aug-2022 11:31:07

1K+ Views

To quickly convert Decimal to other based, we will be using the Built-in functions in Python − Decimal to Binary − bin() Decimal to Octal − oct() Decimal to Hexadecimal − hex() Decimal number system has base 10 as it uses 10 digits from 0 to 9. In ... Read More

Python Helpers for Computing Deltas

AmitDiwan

AmitDiwan

Updated on 11-Aug-2022 11:02:59

260 Views

The difflib module is used in Python to compute deltas. It is used to compare files, and can produce information about file differences in various formats, including HTML and context and unified diffs. We need to first import the difflib module before using it − import difflib Class (difflib.SequenceMatcher) ... Read More

Python Numeric Types

AmitDiwan

AmitDiwan

Updated on 11-Aug-2022 11:00:28

5K+ Views

The Numeric Types in Python are the integer datatypes. It includes integers, floatimg point, complex, etc. The complex includes real and imag parts. Also, includes Hexadecimal and Octal types. Python int datatype The Numeric Types include the int datatypes − a = 5 print("Integer = ", a) print("Type = ", ... Read More

Python program to sort a list according to the second element in the sublist.

AmitDiwan

AmitDiwan

Updated on 11-Aug-2022 08:56:19

1K+ Views

In this article, we will sort a list according to the second element in the sublist. Let’s say we have the following list − [['jack', 50], ['antony', 20], ['jones', 87], ['gary', 70], ['tom', 90], ['sam', 110], ['warner', 65]] The output should be the following i.e. sorted according to the ... Read More

Smallest possible length constituting greatest frequency in JavaScript

AmitDiwan

AmitDiwan

Updated on 27-Jun-2022 06:50:58

162 Views

ProblemWe are required to write a JavaScript function that takes in an array of numbers, arr, as the first and the only argument.Our function is supposed to find the smallest possible length of a (contiguous) subarray of the array arr, that has the same greatest frequency of any element as ... Read More

Java Program to Iterate over a HashMap

AmitDiwan

AmitDiwan

Updated on 30-Mar-2022 09:08:14

464 Views

In this article, we will understand how to iterate over a HashMap. Java HashMap is a hash table based implementation of Java's Map interface. It is a collection of key-value pairs.Below is a demonstration of the same −Suppose our input is −Input Hashmap: {Java=Enterprise, JavaScript=Frontend, Mysql=Backend, Python=ML/AI}The desired output would ... Read More

Advertisements