
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
Python Articles - Page 950 of 1048

354 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

260 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

184 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

374 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

10K+ Views
We'll learn how to split and join a string in Python in this article. Python defines strings as a collection of characters enclosed in one, two, or three quotations. When a string is split, it is divided into smaller strings using a specific delimiter. A set of one or more characters used to define a boundary is known as a delimiter. Anything could serve as a delimiter. The comma (, ), semicolon (;), tab (t), space (), and pipe (|) are the most widely used delimiters. Everywhere the specified delimiter appears in a given string, we must split it, and ... Read More

26K+ Views
You will understand how to multiply every number in a list in Python in this article using various methods. A list is an ordered collection of values that are enclosed in square brackets. List contains values known as items that can be retrieved by their unique index. We'll create a function that multiplies each value in the list and outputs the result. The result of multiplying all the values is a single thing. For instance, the result will be 36 for the list [3, 2, 6]. We will go over the various methods for calculating the sum of all the ... Read More

2K+ Views
In this article, we will learn how to remove and print every third element or item from the list until it becomes empty using Python Program. First we create a list, the index of the starting address is 0 and the position of the first third element is 2 and need to traverse till the list becomes empty and another important work to do every time we have to find the index of the next third element and print the value and after that reduce the length of the list. Input-Output Scenario Following is the input and its output scenario ... Read More

3K+ Views
The use of the symbol * (asterisks) in writing or printing as a reference mark, a sign that some letters or words have been omitted, a way to indicate a possible but unproven linguistic form, or for other arbitrary purposes. In this article we will discuss different ways to replace a word with asterisks in a sentence in Python. Input-Output Scenarios Following is an input and its output scenario of replacing a word in a sentence with asterisks − Input: Welcome to the TutorialsPoint family. Output: Welcome to the TutorialsPoint ****** We can see in the above scenario that ... Read More

667 Views
We want to replace a character a1 with a character a2 and a2 with a1. For example, For the input string, "puporials toinp"and characters p and t, we want the end string to look like −"tutorials point"For this we can use map function and lambdas to make the replacement. The map(lambda, input) function iterates over each item passed to it(in form of iterable input) and apply the lambda expression to it. So we can use it as follows −Example Live Demodef replaceUsingMapAndLambda(sent, a1, a2): # We create a lambda that only works if we input a1 or a2 and swaps them. ... Read More