Server Side Programming Articles

Page 4 of 2109

How to Print a Heart Pattern Using Python?

Nilesh Kumar
Nilesh Kumar
Updated on 02-Apr-2026 4K+ Views

Creating visual patterns with code is both educational and fun. In this article, we'll learn how to print a heart pattern using Python, which demonstrates loop control, conditional logic, and coordinate-based pattern generation. Understanding the Range Function The heart pattern uses nested loops with the range() function ? range(start, stop, step) Parameters: start − Starting position (optional, default is 0) stop − Ending position (required) step − Increment value (optional, default is 1) Heart Pattern Algorithm The heart pattern is created by dividing it into two main parts: Upper ...

Read More

How To Add Color Bar In Bokeh

Shashank Dharasurkar
Shashank Dharasurkar
Updated on 02-Apr-2026 508 Views

In Python, Bokeh is one of the most powerful libraries for data visualization that goes beyond traditional plotting. It follows a unique "Grammar of Graphics" architecture that allows developers to build interactive visualizations by managing graphical elements together. A Bokeh plot brings your data to life with its seamless integration with Pandas, NumPy, and SciPy. What is a Color Bar? A color bar is a visualization tool where color is used to represent a continuous variable like in a heatmap. The main objective of the color bar is to allow users to understand the relationships between data values ...

Read More

path_curve_to_quadratic_bezier() function in Python Wand

Vishal Gupta
Vishal Gupta
Updated on 02-Apr-2026 443 Views

The quadratic Bézier curve is a mathematical function used to create smooth, curved paths in 2D space. It's defined by three points: two endpoints and one control point that influences the curve's shape without the curve necessarily passing through it. A quadratic Bézier curve uses the mathematical formula B(t) = (1-t)²P₀ + 2(1-t)tP₁ + t²P₂, where P₀ is the start point, P₁ is the control point, P₂ is the end point, and t ranges from 0 to 1. Mathematical Formula The quadratic Bézier curve is calculated using this parametric equation − def quadratic_bezier(p0, p1, p2, ...

Read More

Check if a Thread has Started in Python

Mukul Latiyan
Mukul Latiyan
Updated on 02-Apr-2026 7K+ Views

Multithreading allows Python programs to execute multiple tasks simultaneously using the threading module. When working with threads, it's crucial to monitor their status — whether they've started, are currently running, or have finished execution. Python provides several methods to check thread status. The most common approach is using the is_alive() method, which returns True if a thread is currently running and False otherwise. Using is_alive() Method The is_alive() method is the primary way to check if a thread has started and is currently active ? import threading import time def worker_function(): ...

Read More

Save API data into CSV format using Python

Prince Yadav
Prince Yadav
Updated on 02-Apr-2026 3K+ Views

In the world of data-driven applications and analysis, APIs (Application Programming Interfaces) play a crucial role in retrieving data from various sources. When working with API data, it is often necessary to store it in a format that is easily accessible and manipulatable. One such format is CSV (Comma Separated Values), which allows tabular data to be organized and stored efficiently. This article will explore the process of saving API data into CSV format using Python. Let's assume we have an API endpoint that offers data in JSON format. Our objective is to obtain this data and store it ...

Read More

Playing a Beep Sound in Python: winsound Module

Gaurav Leekha
Gaurav Leekha
Updated on 27-Mar-2026 4K+ Views

The Python winsound module is a simple way to play audio files and generate beep sounds on Windows machines. It provides a straightforward interface for playing sound files, generating system beeps, and working with MIDI devices using just a few lines of code. The winsound module is part of the Python standard library, so you don't need to install it separately. While it has some limitations such as only supporting a limited number of audio file formats and being Windows-specific, it can be a useful tool for simple audio tasks in Python. In this tutorial, we'll explore how ...

Read More

Choropleth maps using Plotly in Python

Gaurav Leekha
Gaurav Leekha
Updated on 27-Mar-2026 1K+ Views

A choropleth map is a map that displays data on geographic regions using different colors or shades to represent values. The data is usually represented as a color scale, with darker colors indicating higher values and lighter colors indicating lower values. Choropleth maps are useful for visualizing data on a map, such as demographic data, election results, or economic indicators. Plotly is a Python data visualization library that allows users to create interactive plots and charts. It offers a range of features for creating custom visualizations, including line charts, scatterplots, bar charts, and choropleth maps. In this tutorial, we ...

Read More

Choose element(s) from List with different probability in Python

Gaurav Leekha
Gaurav Leekha
Updated on 27-Mar-2026 2K+ Views

An important aspect of creating accurate simulations is the ability to choose elements from a list with different probabilities. For example, in a simulation of a crowd, certain actions may be more likely to occur than others, or in a simulation of a physical system, particles may move with different probabilities in different directions. Python provides several ways to choose elements from a list with different probabilities. In this tutorial, we'll explore different techniques using the built-in random module and the NumPy module. Choosing Elements with Equal Probability Let's first discuss how to choose elements from a ...

Read More

Chi-Square Test for Feature Selection in Machine Learning

Gaurav Leekha
Gaurav Leekha
Updated on 27-Mar-2026 835 Views

Feature selection is an important aspect of machine learning that involves selecting a subset of features from a larger set to improve model performance. It helps reduce complexity, improve accuracy, and make models more interpretable. A common approach to feature selection is the Chi-Square test. This tutorial explains what the Chi-Square test is, how it's used for feature selection, and provides a Python implementation. What is the Chi-Square Test? The Chi-Square test is a statistical test used to determine if there is a significant association between two categorical variables. It's based on the Chi-Square distribution, which describes ...

Read More

Chi-Square Distance in Python

Gaurav Leekha
Gaurav Leekha
Updated on 27-Mar-2026 2K+ Views

The Chi-square distance is a statistical measure used to compare the similarity or dissimilarity between two probability distributions. It is widely used in data analysis and machine learning for applications such as feature selection, clustering, and hypothesis testing. Python's SciPy library provides convenient functions to calculate Chi-square statistics, making it accessible for various data science projects. In this tutorial, we will explore the Chi-square distance in Python and demonstrate its implementation using SciPy and scikit-learn libraries. What is Chi-square Distance? The Chi-square distance measures the similarity or difference between two probability distributions. It is based on the ...

Read More
Showing 31–40 of 21,090 articles
Advertisements