Found 10400 Articles for Python

Statistical Functions in Python

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

3K+ Views

Python has ability to solve the mathematical expression, statistical data by importing statistic keyword. Python can do various types of statistical and mathematical operations. These functions calculate the average value from a sample or population. mean () Arithmetic mean value (average) of data. harmonic_mean () Harmonic mean value of data. median () Median value (middle value) of data. median__low() Low median value of data. median__high() High median value of data. median__grouped() Median of the grouped data and also calculate the 50th percentile of the grouped data. ... Read More

Python program to find the size of the largest subset of anagram words

Sarika Singh
Updated on 04-Apr-2023 11:59:46

439 Views

This article teaches you how to write a Python program to find the size of the largest subset of anagram words Every character of the rearranged string or number must also be a component of another string or number in order for the condition of an anagram to exist. To put it another way, a string is said to be an anagram of another if the second is just the first string rearranged. As an illustration, the words The program and rogPrma are anagrams, as are the words Code and doCe. Input-Output Scenarios Lets take an input and its output ... Read More

Python Program to check if two given matrices are identical

Sarika Singh
Updated on 23-Nov-2022 07:22:21

4K+ Views

Matrix refers to a collection of numbers arranged in rows and columns to form a rectangular array. The numbers make up the matrix's entries, or elements. We need to create a Python function to determine whether two given matrices are identical. In other words, we say that two matrices are identical if all of the elements in their respective places are the same. Identical Matrices Two matrices are only considered equal if and when they meet the requirements listed below − There should be an equal number of rows and columns in each matrices. The identical corresponding items should ... Read More

Create Word Cloud using Python

Akshitha Mote
Updated on 23-Jun-2025 17:12:23

1K+ Views

A "word cloud" is a visual representation of text data, where the size of each word indicates its frequency or importance within the dataset. It helps us to identify the most common and important words in a text. It is typically used to describe/denote big data in a word. In this article, we will create a word cloud on the Python programming language, and the data is accessed from Wikipedia. Modules to create a Word Cloud in Python Following are the modules required to create a word cloud in Python : Install wordcloud Before installing the word cloud module, you have ... Read More

How to convert HTML to PDF using Python

Akshitha Mote
Updated on 23-Jun-2025 17:08:48

2K+ Views

In general, we look at some external websites to convert our files to PDF format; instead, we can convert them using Python on our own. In this article, we will understand the steps to convert the HTML (Hyper Text Markup Language) to PDF using Python code. Steps to convert HTML to PDF Following are the steps to convert the HTML file to PDF using Python: Step 1: Installation Download the pdfkit library by running the following command in the command prompt: pip install pdfkit Step 2: Download wkhtmltopdf Following are the steps to download wkhtmltopdf: ... Read More

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

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 second element − [['antony', 20], ['jack', 50], ['warner', 65], ['gary', 70], ['jones', 87], ['tom', 90], ['sam', 110]] Python program to sort a list according to the second element in the sublist using the sort() method Example # Custom Function def SortFunc(sub_li): sub_li.sort(key = lambda x: x[1]) return sub_li ... Read More

Python program to calculate BMI(Body Mass Index) of your Body

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

1K+ Views

We have to enter our height and weight. Our task is to calculate BMI using formula. Algorithm Step 1: input height and weight of your body. Step 2: then applying the formula for calculation BMI. Step 3: display BMI. Example Code height = float(input("Enter your height(m): ")) weight = float(input("Enter your weight(kg): ")) print("Your BMI is: ", round(weight / (height * height), 2)) Output Enter your height (m): 5.8 Input your weight (kg): 64 Your body mass index is: 1.9

Python program multiplication of two matrix.

Samual Sam
Updated on 30-Jul-2019 22:30:23

20K+ Views

Given two user input matrix. Our task is to display the addition of two matrix. In these problem we use nested List comprehensive. Algorithm Step1: input two matrix. Step 2: nested for loops to iterate through each row and each column. Step 3: take one resultant matrix which is initially contains all 0. Then we multiply each row elements of first matrix with each elements of second matrix, then add all multiplied value. That is the value of resultant matrix. Example Code # Program to multiply two matrices A=[] n=int(input("Enter N for N x N matrix: ")) ... Read More

Python program for Modular Exponentiation

Akshitha Mote
Updated on 23-Jun-2025 17:26:07

762 Views

What is Modular Exponentiation? To calculate Modular exponentiation, we need to raise a base to an exponent and then calculate the modulus of the result. This includes 3 integers: base, exponent, and modulo. Following is the syntax of the modular exponentiation in Python - (base**exponent) % modulo For instance, consider (2^5) % 5, which indicates 2 raised to the power of 5, which results in 32; When the modulo operation is performed, it returns the remainder, i.e., 32 % 5 is 3. Modular Exponentiation using Recursive Function A function that calls itself is known as a recursive function. Following is ... Read More

String slicing in Python to rotate a string

karthikeya Boyini
Updated on 23-Jun-2020 16:09:07

5K+ Views

A string is given, our task is to slicing the string into two way. One is clockwise and another anticlockwise.1. Left (Or anticlockwise) rotate the given string by d elements (where d pythonprogram Left Rotation: thonprogrampy Right Rotation: ampythonprogr

Advertisements