
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
Found 33676 Articles for Programming

777 Views
The binary numbers are the basis of how data is stored, processed and transferred. Every integer is internally represented by using a sequence of bits (combination of 0s and 1s). In this article, we will learn how to check if binary representation of two numbers are anagram. Two numbers are said to be binary anagrams if their binary representations contains the same number of 1s and 0s. For example, the number 12 in binary is 1100 and the number 10 in binary is 1010, both have two 0s and two 1s, making them binary anagrams. Using collections.Counter() Class ... Read More

263 Views
Given a number n, print m multiplies of n without using any loop. Here we use recursive function. Examples Input: n = 15 Output: 15 10 5 0 5 10 15 Algorithm Step 1: Given n. Step 2: If we are moving back toward the n and we have reached there, then we are done. Step 3: If we are moving toward 0 or negative. Step 4: If m is greater, then 5, recursive function with true flag else recursive function is false. Step 5: If m is not greater than 5 then flag is false. ... Read More

2K+ Views
In this article, we will explore how to find missing and additional values in two lists. This type of comparison is can be encountered in the real-world scenarios such as data validation or system synchronization. The task is to determine which elements are missing in one list and what unexpected elements were received. This can be achieved by using the python built-in data structures like sets that allows for easy comparison. Using set() Function The python set() function is used to used to create a new set. A set is a collection of unique elements (each ... Read More

391 Views
Given a sentence. Our task is to check whether this sentence is pan grams or not. The logic of Pan grams checking is that words or sentences containing every letter of the alphabet at least once. To solve this problem we use set () method and list comprehension technique. Example Input: string = 'abc def ghi jkl mno pqr stu vwx yz' Output: Yes // contains all the characters from ‘a’ to ‘z’ Input: str='python program' Output: No // Does not contains all the characters from ‘a’ to 'z' Algorithm Step 1: create a string. Step 2: ... Read More

2K+ Views
This function is use to extract k bits from pos position and returns the extracted value. Here we use python slicing technique. Example Input:: number=170 K=5 Pos=2 Output=21 Algorithm Extractionbit(no, k, pos) /*user input number is stored in variable no, extracted bit is stored in variable k and the position of bit is pos. */ Step 1 : first convert the number into its binary form using bin(). Step 2 : remove the first two character. Step 3 : then extracting k bits from starting ... Read More

3K+ Views
The string manipulation is the common task in the python programming, especially when working with the text based data. In this article we will explore how to reverse each word in a sentence. Generally, we reverse the entire sentence, where the both characters and the word positions are flipped, but in this task we are reversing only characters within each word while maintaining the original sequence of the words. For example if the input is "Welcome", the expected output would be "emocleW". Using Python split() Method The Python split() method is used to split all the words in ... Read More

1K+ Views
In Python, Lists are one of the built-in data type used for storing collections of data. Python list is a sequence of comma separated items, enclosed in square brackets[]. They are flexible, easy to manipulate and widely used in various applications. In this article, we will explore to list the difference between two lists. Python provides the several built-in methods for achieving this. Using set.difference() Method The python set.difference() method is used to return the new set containing the elements that are present in the first set but not in any other sets provided as arguments. ... Read More

1K+ Views
The distinct elements are the values that appears only once or uniquely in the array. When working with the array we will come across the repeated or duplicate values. In this article, we are going to print all the distinct elements of a given array. Identifying and printing these distinct elements is a common task to avoid the unexpected results. This can be achieved by using the Python built-in tools like sets and dictionaries. Using Python set() Function In this approach we are using Python set() function, which removes all the duplicate value from the list because a ... Read More

618 Views
The checkboard pattern is the square grid composed of alternating 0s and 1s, arranged in a way that no two adjacent cells have the same value. It looks like the chessboard, where black and white squares alternate in every row and column. This kind of pattern is not only seen in chess or checkers, but also in image processing, graphics, and visualization, etc. In this article, we are going to learn how to print a checkboard pattern of n*n using numpy. Using Python numpy.indices() Method The numpy.indices() method is used to return the grid of indices with ... Read More

2K+ Views
The cyclic rotation of an array involves moving every element of the array one position forward, and the last element gets moved to the first position. For example, if the given array is [1, 2, 3, 4] then the array after one cyclic rotation is [4, 1, 2, 3]. In this article, we are going to learn how to cyclically rotate an array by one position using Python. Using Python insert() and pop() Methods The Python insert() method is used to insert or add an element at the specified index. The index value starts from zero. Following ... Read More