Programming Articles

Page 59 of 2547

Python regex - Check whether the input is Floating point number or not

Mrudgandha Kulkarni
Mrudgandha Kulkarni
Updated on 27-Mar-2026 2K+ Views

Floating point numbers play a crucial role in various programming tasks, from mathematical computations to data analysis. When working with user input or data from external sources, it becomes essential to validate whether the input is a valid floating point number. Python's regular expressions provide a powerful tool to tackle this challenge. In this article, we will explore how to use regular expressions in Python to check whether the input is a floating point number. Regular expressions, commonly known as regex, offer a concise and flexible way to define patterns and search for matches within text. Understanding Floating ...

Read More

Generate a Waffle chart using pyWaffle in Python

Jaisshree
Jaisshree
Updated on 27-Mar-2026 673 Views

Data visualization is crucial for efficient information comprehension and presentation. Among the many chart types available, waffle charts offer a unique way to display data as square tiles in a grid-like structure. The powerful Python module PyWaffle facilitates waffle chart development for categorical data visualization. In this article, we'll explore how to create waffle charts using PyWaffle and analyze different datasets through visual representation. Installation First, install the PyWaffle library using pip ? pip install pywaffle Basic Waffle Chart - Sales Distribution Let's create a waffle chart to analyze the monthly sales report ...

Read More

Generate Random Numbers From The Uniform Distribution using NumPy

Jaisshree
Jaisshree
Updated on 27-Mar-2026 1K+ Views

The uniform distribution generates random numbers where each value within a specified range has an equal probability of being selected. NumPy's random.uniform() function provides an efficient way to generate such random numbers for statistical analysis, simulations, and machine learning applications. Syntax numpy.random.uniform(low=0.0, high=1.0, size=None) Parameters low: Lower boundary of the output interval. All values generated will be greater than or equal to low. Default is 0.0. high: Upper boundary of the output interval. All values generated will be less than high. Default is 1.0. size: Output shape. If given as an integer, ...

Read More

Python Raw Strings

Mrudgandha Kulkarni
Mrudgandha Kulkarni
Updated on 27-Mar-2026 1K+ Views

When working with strings in Python, you might encounter situations where special characters, escape sequences, or backslashes cause unexpected behavior. This is where raw strings come to the rescue. Raw strings, denoted by the 'r' prefix, offer a convenient way to handle strings without interpreting escape sequences or special characters. Raw strings are particularly useful when dealing with regular expressions, file paths, and any scenario that involves literal string representations. In this article, we'll explore how raw strings differ from regular strings and understand their practical applications. Understanding Raw Strings Raw strings are defined by prefixing a ...

Read More

Generate HTML using Tinyhtml Module using Python

Jaisshree
Jaisshree
Updated on 27-Mar-2026 1K+ Views

Tinyhtml is a Python library for generating HTML5 code programmatically. This lightweight library is useful when you need to create HTML without manually writing markup syntax, making it ideal for dynamic web content generation. The library integrates easily with Python frameworks like Flask and Django, and can render HTML snippets in Jupyter Notebooks. Its compact nature makes it perfect for generating HTML code dynamically without manual intervention. Installation Install tinyhtml using pip ? pip install tinyhtml Core Functions Tinyhtml provides several key functions for HTML generation ? html() − Creates ...

Read More

Python program to uppercase the given characters

Mrudgandha Kulkarni
Mrudgandha Kulkarni
Updated on 27-Mar-2026 315 Views

Text processing often requires manipulating the case of characters in a string. One common task is converting lowercase characters to uppercase. In Python, there are built−in functions and methods that simplify this task. In this article, we will explore how to write a Python program to convert characters to uppercase. Uppercasing characters is essential for various applications, such as data cleaning, text analysis, and string matching. By converting characters to uppercase, we can ensure uniformity, improve readability, and enable effective comparison and matching operations. Understanding the Problem We need to create a Python program that takes a ...

Read More

Generate five Random Numbers from the Normal Distribution using NumPy

Jaisshree
Jaisshree
Updated on 27-Mar-2026 3K+ Views

In the study of statistics and data analysis, normal distribution or Gaussian Distribution is a widely used probability distribution. It is a bell-shaped curve that characterizes probability and is often used to model real-world phenomena. We use the random module available in Python's NumPy library to generate random numbers from the normal distribution. It allows users to generate random numbers with a specified mean and standard deviation. Syntax numpy.random.normal(loc=0.0, scale=1.0, size=None) Parameters loc (float or array_like): The mean or center of the distribution. Default value is 0.0 and represents the peak of the ...

Read More

Python program to update a dictionary with the values from a dictionary list

Mrudgandha Kulkarni
Mrudgandha Kulkarni
Updated on 27-Mar-2026 4K+ Views

In Python, dictionaries are powerful data structures that store key-value pairs. Sometimes we need to merge multiple dictionaries from a list into a single dictionary. This operation combines all key-value pairs, with later values overwriting earlier ones for duplicate keys. This article explores three efficient approaches: using a for loop with update(), dictionary comprehension, and the ChainMap method. Using For Loop with update() Method The update() method merges one dictionary into another. We can iterate through a list of dictionaries and update our target dictionary ? Example # Create an empty dictionary target_dict = ...

Read More

Python Program to test if the String only Numbers and Alphabets

Mrudgandha Kulkarni
Mrudgandha Kulkarni
Updated on 27-Mar-2026 773 Views

When working with strings in Python, it is often necessary to validate whether a string contains only numbers and alphabets or if it includes other special characters. String validation is crucial in various scenarios such as input validation, data processing, and filtering. In this article, we will explore a Python program to test if a given string consists of only alphanumeric characters. We will discuss the criteria for a valid string, provide examples of valid and invalid strings, and present efficient approaches to solve this problem using built-in string methods. Understanding the Problem Before we dive into ...

Read More

Python program to swap two elements in a list

Mrudgandha Kulkarni
Mrudgandha Kulkarni
Updated on 27-Mar-2026 5K+ Views

In Python programming, lists are a versatile and commonly used data structure. At times, we may need to swap the positions of two elements within a list to reorganize data or perform specific operations. This article explores different methods to swap two elements in a list, from basic temporary variable approach to Python's elegant tuple unpacking technique. Understanding the Problem Swapping two elements in a list means exchanging their positions. Given a list and two indices (i and j), we want to interchange the elements at those positions. For example, if we have a list [1, ...

Read More
Showing 581–590 of 25,469 articles
« Prev 1 57 58 59 60 61 2547 Next »
Advertisements