Found 10476 Articles for Python

Python Numeric Types

AmitDiwan
Updated on 11-Aug-2022 11:00:28

5K+ Views

The Numeric Types in Python are the integer datatypes. It includes integers, floatimg point, complex, etc. The complex includes real and imag parts. Also, includes Hexadecimal and Octal types. Python int datatype The Numeric Types include the int datatypes − a = 5 print("Integer = ", a) print("Type = ", type(a)) Output Integer = 5 Type = Python float datatype The Numeric Types include the float datatypes − Example a = 7E2 print("Float = ", a) print("Type = ", type(a)) Output Float = 700.0 Type = Python complex datatype The Numeric Types include the ... Read More

Python program for removing n-th character from a string?

Akshitha Mote
Updated on 23-Jun-2025 19:30:06

1K+ Views

The problem statement is to remove the nth character from the given string. Let's understand with an example. Consider my_string = "Tutorialspoint". The given value of n is 6; then we need to remove the 5th character from the string. Because the index value starts from zero. And it should result in "Tutorialspoint". Removing nth Character using a for Loop The for loop can be used to remove the n-th character from a string. In this approach, we iterate through each index of the string and print the characters. If the index value is equal to the given (n-1)th value, we ... Read More

Python program to check for URL in a string

Sarika Singh
Updated on 04-Apr-2023 11:47:24

3K+ Views

This article will teach you how to determine whether a string contains a URL or not. In Python, strings are collections of bytes that represent Unicode characters. You can use single or double quotes and everything enclosed in them is considered as a string. When given a string, we will first determine whether it contains a URL. If one is found, we will then print the URL. Using findall() method We will employ Python's regular expression concept to resolve this issue. Regular expressions are supported by the Python re package. Using a particular syntax defined in a pattern, a regular ... Read More

Python Program to print unique values from a list

Sarika Singh
Updated on 23-Nov-2022 08:24:42

3K+ Views

List is a built-in data structure in python which functions like a dynamically sized array. Lists are created by putting elements in square brackets ‘[element 1, element 2, ….]’. Elements present in list are indexed and the indexing starts from [0]. List has the following properties − List is mutable meaning that elements can be added, removed or changed from a list after its creation. List is ordered, so adding new elements to the list will not change the order of existing elements. List allows for entry of duplicate elements since each element has a unique index. A single ... Read More

Python program to sort a tuple by its float element

Sarika Singh
Updated on 23-Nov-2022 07:33:43

2K+ Views

This article will demonstrate how write a Python program to sort a tuple (made up of float elements) using its float elements. Here, we'll look at both how to sort using the in-built sorted() function and how to sort using the in-place method of sorting. Input-Output Scenarios Following is an input and its output scenario determining the sorting of a tuple by its float element − Scenario-1 Input: tuple = [(‘Dengu’, ’54.865’), (‘Malaria’, ‘345.743’), (‘Corona’, ‘456.864’), (‘Typhoid’, ‘35.285’), (‘Jaundice’, ’83.367’)] Output: [(‘Corona’, ‘456.864’), (‘Malaria’, ‘345.743’), (‘Jaundice’, ’83.367’), (‘Dengu’, ’54.865’), (‘Typhoid’, ‘35.285’)] In the above scenario we can see that ... Read More

Python Program to find mirror characters in a string

Sarika Singh
Updated on 23-Nov-2022 07:25:19

3K+ Views

This article teaches you how to write a python program to find mirror characters in a string. Let us first understand what mirror characters in a string are. Two identical alphabetically positioned characters, one from the front and the other from the back, are known as mirror characters. For example, the alphabet a's mirror character is "z, " "b's" is "y, " and so on. Input-Output Scenario Following is an input and its output example of mirror characters in a string − Input: p = 3 Input string = Coding Output: Cowrmt Here, the alphabets “d”, “i”, “n”, “g” ... Read More

Calendar function in Python

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

2K+ Views

Python has an in built module called calendar which operation is related to calendar. There are some calendar functions in Python. calendar(year, w, l, c) This function shows the year, width of characters, no. of lines per week and column separations. Example print ("The calendar of 2014 is : ") print (calendar.calendar(2014, 3, 1, 4)) Output The calendar of year 2014 is : 2014 January ... Read More

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

493 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

Advertisements