Programming Articles

Page 415 of 2547

How to draw different shapes using the Python Turtle library?

Prasad Naik
Prasad Naik
Updated on 25-Mar-2026 4K+ Views

The Python Turtle library provides a fun way to create graphics by controlling a turtle that moves around a drawing canvas. In this tutorial, we'll learn how to draw different geometric shapes including squares, rectangles, circles, and hexagons using turtle graphics. What is Turtle Graphics? Turtle graphics is a drawing method where you control a "turtle" that moves around the screen, leaving a trail behind it. You can command the turtle to move forward, turn left or right, and lift or lower its pen to create various shapes and patterns. Drawing a Square A square has ...

Read More

Python program to compare two Pandas series

Prasad Naik
Prasad Naik
Updated on 25-Mar-2026 688 Views

In this program, we will declare two Pandas series and compare their elements using comparison operators. Pandas provides element-wise comparison operations that return boolean Series objects. Before we solve the problem, we need to import the Pandas library into our local IDE. This can be done by installing Pandas on our local machine. The command for installing Pandas is − pip install pandas Input Data We will use two sample series for comparison ? Series1 = [2, 4, 6, 8, 10] Series2 = [1, 3, 5, 7, 9] Algorithm ...

Read More

How to maximize a plt.show() window using Python?

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 25-Mar-2026 5K+ Views

To maximize a matplotlib plot window, you can use the figure manager's built-in methods. The most common approach is using plt.get_current_fig_manager() along with full_screen_toggle() or window.state() methods. Method 1: Using full_screen_toggle() This method toggles the window to full screen mode ? import matplotlib.pyplot as plt plt.subplot(1, 1, 1) plt.pie([1, 2, 3], labels=['A', 'B', 'C']) plt.title('Sample Pie Chart') mng = plt.get_current_fig_manager() mng.full_screen_toggle() plt.show() Method 2: Using window.state() (Tkinter backend) For Tkinter backend, you can maximize the window using the state method ? import matplotlib.pyplot as plt plt.subplot(1, 1, 1) ...

Read More

How to make two plots side-by-side using Python?

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 25-Mar-2026 32K+ Views

When creating data visualizations, you often need to display multiple plots side-by-side for comparison. Python's Matplotlib provides the subplot() method to divide a figure into multiple sections and place plots in specific positions. Using plt.subplot() Method The subplot(nrows, ncols, index) method splits a figure into a grid of nrows × ncols sections. The index parameter specifies which section to use for the current plot ? from matplotlib import pyplot as plt import numpy as np # Create sample data x_points = np.array([2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) y1_points = np.array([12, 14, ...

Read More

Saving images in Python at a very high quality

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 25-Mar-2026 9K+ Views

To save images in Python with very high quality, you need to control the image format and resolution. The most effective approach is using matplotlib's savefig() method with optimized parameters. Steps for High-Quality Image Saving Create fig and ax variables using subplots() method, where default nrows and ncols are 1. Plot the data using plot() method. Add axes labels using ylabel() and xlabel(). Use vector formats like .eps, .pdf, or .svg for scalable quality. Increase the DPI (dots per inch) value for ...

Read More

Python program to remove duplicate elements from a Circular Linked List

AmitDiwan
AmitDiwan
Updated on 25-Mar-2026 432 Views

When it is required to remove duplicates from a circular linked list, a Node class needs to be created. In this class, there are two attributes: the data that is present in the node, and the access to the next node of the linked list. In a circular linked list, the head and the rear are adjacent to each other. They are connected to form a circle, and don't have NULL value in the last node. Another class needs to be created that would have an initialization function, and the head of the node would be initialized to ...

Read More

Python program to insert a new node at the middle of the Circular Linked List

AmitDiwan
AmitDiwan
Updated on 25-Mar-2026 408 Views

When it is required to insert a new node at the middle of the circular linked list, a Node class needs to be created. In this class, there are two attributes: the data that is present in the node, and the access to the next node of the linked list. In a circular linked list, the head and the rear are adjacent to each other. They are connected to form a circle, and don't have 'NULL' value in the last node. Instead, the last node points back to the first node. Node Class Structure The Node class ...

Read More

Python program to insert a new node at the end of the Circular Linked List

AmitDiwan
AmitDiwan
Updated on 25-Mar-2026 527 Views

When it is required to insert a new node at the end of the circular linked list, a Node class needs to be created. In this class, there are two attributes: the data that is present in the node, and the access to the next node of the linked list. In a circular linked list, the head and the tail are adjacent to each other. They are connected to form a circle, and don't have NULL value in the last node. Instead, the last node points back to the first node. ...

Read More

Python program to insert a new node at the beginning of the Circular Linked List

AmitDiwan
AmitDiwan
Updated on 25-Mar-2026 675 Views

When it is required to insert a new node at the beginning of a circular linked list, a 'Node' class needs to be created. In this class, there are two attributes, the data that is present in the node, and the access to the next node of the linked list. In a circular linked list, the head and the rear are adjacent to each other. They are connected to form a circle, and don't have 'NULL' value in the last node. Instead, the last node points back to the first node. Node Class Structure First, we create ...

Read More

Python program to find the maximum and minimum value node from a circular linked list

AmitDiwan
AmitDiwan
Updated on 25-Mar-2026 393 Views

When it is required to find the maximum and minimum node values from a circular linked list, a Node class needs to be created. In this class, there are two attributes: the data present in the node, and the access to the next node of the linked list. In a circular linked list, the head and the tail are adjacent to each other. They are connected to form a circle, and don't have None value in the last node − instead, the last node points back to the first node. Implementation The implementation involves creating a Node ...

Read More
Showing 4141–4150 of 25,466 articles
« Prev 1 413 414 415 416 417 2547 Next »
Advertisements