Found 10784 Articles for Python

How to merge a transparent PNG image with another image using PIL?

Tarun Singh
Updated on 31-Aug-2023 11:25:28

1K+ Views

In the world of image processing, merging two or more images together is a common operation. One common use case is to merge a transparent PNG image with another image to create a composite image that contains both images. In this article, we will learn how to merge a transparent PNG image with another image using PIL. PIL is a powerful library for working with images in Python. It provides a range of functions for opening, manipulating, and saving different types of image files. The library is compatible with a wide range of image formats, including JPEG, PNG, BMP, ... Read More

Multiplying Alternate elements in a List using Python?

Adeeba Khan
Updated on 05-Sep-2023 13:57:22

72 Views

Every programmer needs to be able to work with arrays and perform calculations on the data they contain. Multiplying alternative elements in a list is the specific task that will be the focus of this Python program. By solving this issue, we will improve our programming abilities and learn more about manipulating arrays and doing mathematical computations. Because they are flexible data structures, arrays are essential for storing and managing collections of elements. To manage arrays effectively, Python provides a large selection of effective tools and features. By addressing the problem of multiplying alternative items, we will investigate various techniques ... Read More

Python Program for Convert characters of a string to opposite case

Shubham Vora
Updated on 29-Aug-2023 19:14:16

266 Views

In this problem, we will toggle the case of each string character. The easiest way to toggle the case of each string character is using the swapcase() built-in method. Also, we can use the ASCII values of the characters to swap their case. Python also contains isUpper() and isLower() methods to check the character's case and the lower() and upper() method to change the case. Here, we will learn different approaches to solving the problem. Problem statement - We have given a string alpha. We need to toggle the case of string characters. It means converting uppercase ... Read More

How To Add Color Breezing Effect Using Pygame?

Shashank Dharasurkar
Updated on 29-Aug-2023 17:00:13

116 Views

A popular Python game development library, Pygame provides a broad range of functions for creating 2D games. Using SDL, a low−level multimedia library, it handles graphics, sound, and input in games. The Pygame library allows you to create Python based games easily and intuitively. Creating a breathing effect A breathing effect is a visual effect where the color of an object pulsates or fades in and out, giving the illusion that it is breathing." By combining RGB values and blending modes, Pygame can create a breathing effect that adds depth and visual interest to game objects. Pygame's color manipulation involves ... Read More

How To Add Color Bar In Bokeh

Shashank Dharasurkar
Updated on 29-Aug-2023 16:58:22

192 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? Color bar is a visualization tool where color is used to represent a continuous variable like a heatmap. The main objective of the color bar is to allow users to understand the ... Read More

How to Add A Color Picker In Bokeh?

Shashank Dharasurkar
Updated on 27-Nov-2023 11:57:50

126 Views

Bokeh is one of the most underrated Python visualization libraries and can be used for various applications, including data analysis, scientific visualization, interactive dashboards, etc. In this blog, we will learn how to add a colorpicker widget in Bokeh. What’s A Color Picker? Color picker is one of the many widgets present in Bokeh. It helps the user to specify an RGB color value. Widgets add interactions to the graphs, which can then help users to update plots or drive new computations without diving into code. Besides the color picker, Bokeh has many interesting widgets like buttons, checkbox groups, ... Read More

Union of Python Tuples

Pranay Arora
Updated on 29-Aug-2023 13:41:48

384 Views

A tuple, in python, is a sequential data structure that consists of a number of values. It is an immutable data structure. Hence, it is tricky to get a union of two tuples. Through this article we will try to dive into a few of the best possible approaches and understand their implementation in Python. Tuples, in python, are immutable, but they can contain mutable objects. Similarly, we can take help of mutable data structures to get our desired union. The union of Python tuples finds applications in removing duplicates, merging data sources, set operations, data deduplication, merging multiple results, ... Read More

Python - Type conversion in Nested and Mixed List

Pranay Arora
Updated on 29-Aug-2023 13:14:18

202 Views

Python is widely used and accepted today because of its versatility and readability. Its powerful features allow developers to perform complex tasks with ease. One such essential feature is type conversion or type casting. Especially with Python lists, which are heterogeneous in nature which often demands converting each nested list element or lists to be converted to a particular data type for use. In mixed lists, it becomes more complex. In this article, we will try to understand and implement type conversion in Nested and Mixed Lists. Through the codes we will decode the python features to implement the ... Read More

Python - Convert List to Single Valued Lists in Tuple

Pranay Arora
Updated on 29-Aug-2023 13:12:48

125 Views

This article is our approach to try and understand the various methods to convert a list to single valued lists in Tuple. We will look into the possible Python programming to achieve the same. We will discuss the implementation details, time and space complexities, and efficiency of each method based on the size of the input list. Developers, data scientists, and general readers with a basic technical background will find this article beneficial for judging the best approach for their specific use cases. In python, converting a list to a tuple of single valued lists is not a complex task. ... Read More

How to print Superscript and Subscript in Python?

Pranay Arora
Updated on 29-Aug-2023 13:10:37

6K+ Views

Python is a multipurpose programming language which is well known to us for its simplicity and power. Whether you are starting as a fresher or an experienced developer, Python helps us with a wide range of tools to control and display text in various formats. Many times we need superscripts and subscripts as part of our writing especially to denote Scientific Notations or values. In this article, we will try to visualize and understand different ways to print superscripts and subscripts in Python. This will allow you to beautify and justify text output and make it visually appealing and equally ... Read More

Advertisements