Answered 4m 40s ago

In this problem we use two user input list. Our task is to check that there is any common element or not. We use very simple traversing technique, traverse both the list and check the every element of first list and second list. Example Input : A = [10, ... Read More

Answered 22m 23s ago

Here given a user input positive integer array. Our task is to find out the number occurring odd number of times. Example Input : A=[2, 4, 7, 7, 4, 2, 2] Output : 2 Algorithm Step 1: Input Array element. Step 2: Write lambda expression and apply. ... Read More

Answered 30m 52s ago

In this case we use re module in Python, Here we accept a string and check if the string contains ant URL in it. If the URL is present in the string then display. We use findall () method to solve this problem. Algorithm Step 1: given string as ... Read More

Answered 28m 6s ago

There are two ways to create a program to swap two numbers. One involves using a temp variable and the second way does not use a third variable. These are explained in detail as follows − Program to Swap Two Numbers using temp Variable The program to swap ... Read More

Answered 34m 44s ago

Data Types in C++ There are many data types in C++ but the most frequently used are int, float, double and char. Some details about these data types are as follows − int - This is used for integer data types which normally require 4 bytes of memory space. ... Read More

Answered 41m 21s ago

Quotient and Remainder are parts of division along with dividend and divisor. The number which we divide is known as the dividend. The number which divides the dividend is known as the divisor. The result obtained after the division is known as the quotient and the number left over is ... Read More

Answered 44m 14s ago

Given an array and we have to do the prefix sum array using function.itertools.accumulate(iterable[, func]) module functions all construct and return iterators. So they should only be accessed by functions or loops that truncate the stream. Make an iterator that returns accumulated sums. Elements may be any addable type including ... Read More

Answered 48m 8s ago

Addition is a basic arithmetic operation. The program to add two numbers performs addition of two numbers and prints their sum on screen. A program that demonstrates addition of two numbers is given as follows − Example Live Demo #include <iostream> using namespace std; int main() ... Read More

Answered 53m 4s ago

Here two lists are given. Our task is to check and found weather two given lists are circularly identical or not. Example Input : A = [100, 100, 10, 10, 100] B = [100, 100, 100, 10, 10] Output : True ... Read More

Answered 53m 4s ago

In a computer system, the binary number is expressed in the binary numeral system while the decimal number is in the decimal numeral system. The binary number is in base 2 while the decimal number is in base 10. Examples of decimal numbers and their corresponding binary numbers are as ... Read More

Answered 58m 28s ago

The objects “cin” and “cout” are used in C++ for input and output respectively. cin is an instance of the istream class and is attached to the standard input device such as the keyboard. cout is an instance of the ostream class and is connected to the standard output device ... Read More

Answered 1h 1m ago

A prime number is a whole number that is greater than one and the only factors of a prime number should be one and itself. Some of the first prime numbers are − 2, 3, 5, 7, 11, 13 ,17 The program to check if a ... Read More

Answered 1h 8m ago

Here one tuple is given, our task is to convert tuples to dictionary. To solve this problem we use the dictionary method setdefault (). This method has two parameter, to convert the first parameter to key and the second to the value of the dictionary. Setdefault (key, value) is a ... Read More

Answered 1h 12m ago

Factors are those numbers that are multiplied to get a number. For example: 5 and 3 are factors of 15 as 5*3=15. Similarly other factors of 15 are 1 and 15 as 15*1=15. The program to display the factors of a number are given as follows. Example Live ... Read More

Answered 1h 18m ago

Given a list, our task is to print all the unique numbers. Example Input:A = [1, 2, 3, 4, 2, 1, 9] Unique list is [1, 2, 3, 4, 9] Algorithm Step 1: Create user input list. Step 2: Create an empty list. Step 3: Traverse ... Read More

Advertisements