
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 10400 Articles for Python

569 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

733 Views
The given task is to find the common element in three sorted arrays. Input Output Scenario Following is an input-output scenario - Input Arrays: array1 = [1001, 1004, 1007, 1009, 1015, 1020] array2 = [1002, 1004, 1009, 1013, 1015, 1022] array3 = [1000, 1004, 1009, 1015, 1021] Output: [1004, 1009, 1015] This is useful in multiple scenarios, for example, if we are filtering mutual friends of three different users in apps like Facebook or comparing product availability in three different e-commerce applications on a third-party website. We are filtering elements that are common in multiple ... Read More

598 Views
In Python, Arrays are commonly used to store and manage collections of data. In this article, we are going to learn how to reverse an array in groups of a given size. For example, let's consider the array and a number k, which represents the size of the array. The goal is to break the array into smaller parts, each containing k elements, and then reverse the elements inside each part. If the elements left at the end are less than k, we will reverse them. Suppose the array is [1, 2, 3, 4, 5, 6] and k=3, then ... Read More

2K+ Views
Here given a password, our task is to check that this Password is valid or not. Here we use re module that provide regular expression and re.search() is used for checking the validation of alphabets, digits or special characters. Algorithm Step 1: first we take an alphanumeric string as a password. Step 2: first check that this string should minimum 8 characters. Step 3: the alphabets must be between a-z. Step 4: At least one alphabet should be in Uppercase A-Z. Step 5: At least 1 number or digit between 0-9. Step 6: At least 1 character from [_ ... Read More

317 Views
In this article, we are going to learn how to iterate over multiple lists simultaneously. It is useful when the lists contain related data. For example, one list stores names, another stores genders, and the last one stores ages. By iterating over these lists simultaneously, we can access the necessary details of a single person. Iterating Over Multiple Lists using zip() Function The Python zip() function is a built-in function used to combine the elements from two or more iterator objects (such as lists, tuples, etc) and returns the result. The resultant iterator object contains tuples where the ith tuple ... Read More

235 Views
Python Program to Count Total Bits in a Number To calculate the total bits in a number, convert it to binary using the bin() function. A bit represents data as 0 or 1, and 8 bits make a Byte. Bits are essential for data transmission, storage, and arithmetic operations, and bitwise operations are also possible. The output of bin() starts with 0b, followed by the binary digits. To find the total bit count, remove the leading 0b after conversion. Syntax Following is the Syntax for the bin() function. Where, number is the number to be converted into binary format variable_name ... Read More

158 Views
Every human being have emotions just like happy, sad, neutral, surprise, sorrow etc., if we create the emotions of images like happy, sad, neutral, surprise, etc. in Python. We can use Microsoft emotion API for any development purpose.We can easily elaborate all these emotions using Microsoft emotion API's.Example Codeimport http.client, urllib.request import urllib.parse, urllib.error import base64, sys import simplejson as json # replace with subscription_key # you obtained after registration subscription_key = '23d39244dbe55173214b56ab45d56cla' headers = { # Request for headers. And also replace the placeholder key with # our subscription key. 'Content-Type': 'application/json', 'Ocp-Apim-Subscription-Key': ... Read More

1K+ Views
The elements in the contiguous memory address are contained in the linear data structure known as an array. At these places, it primarily groups components of the same data type. Given an array of integers. The array is to be divided into two halves, 0s and 1s, according to the article "Segregate 0s and 1s in an array." The array should have all the 0’s on the left and all the 1’s on the right. Input-Output Scenario Let’s consider an input and its output scenarios to segregate 0’s and 1’s in an array list - Input: [0, 1, ... Read More

326 Views
First we take a user input string with the combination of 1’s and 0’s.then create a new string with 1’s, then check if there is any p number of consecutive 1’s is present or not. If present then display FOUND otherwise NOTFOUND. Example Binary number ::1111001111 Enter consecutive 1’s :3 Consecutive 1's is Found Algorithm Step 1: input a string with the combination of 1’s, it’s stored in the variable X and 0’s and p is the consecutive 1’s in a binary number. Step 2: form a new string of p 1’s. newstring=”1”*p Step ... Read More