Found 10476 Articles for Python

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

Rishikesh Kumar Rishi
Updated on 27-Aug-2023 03:24:13

32K+ Views

Using subplot(row, col, index) method, we can split a figure in row*col parts, and can plot the figure at the index position. In the following program, we will create two diagrams in a single figure.StepsCreating x, y1, y2 points using numpy.With nrows = 1, ncols = 2, index = 1, add subplot to the current figure, using the subplot() method.Plot the line using x and y1 points, using the plot() method.Set up the title, label for X and Y axes for Figure 1, using plt.title(), plt.xlabel(), and plt.ylabel() methods.With nrows = 1, ncols = 2, index = 2, add subplot ... Read More

Saving images in Python at a very high quality

Rishikesh Kumar Rishi
Updated on 15-Mar-2021 07:32:19

8K+ Views

To save the images in Python with very high quality, you need to follow the steps given below −Create fig and ax variables using subplots method, where default nrows and ncols are 1.Plot the lines using plot() method.We can add axes labels using ylabel() and xlabel().To get a high-quality image, we can use .eps image format.You can increase the dot per inch value, i.e., dpi.Using savefig() method, we can save the image locally.To show the figure, use plt.show().Exampleimport matplotlib.pyplot as plt fig, ax = plt.subplots() plt.plot([0, 5], [0, 5]) plt.ylabel("Y-axis ") plt.xlabel("X-axis ") image_format = 'eps' ... Read More

Python program to remove duplicate elements from a Circular Linked List

AmitDiwan
Updated on 13-Mar-2021 06:11:06

364 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 'None'. Multiple methods are defined ... Read More

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

AmitDiwan
Updated on 13-Mar-2021 06:06:01

358 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.Another class needs to be created that would have an initialization function, and the head of the node would be initialized ... Read More

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

AmitDiwan
Updated on 13-Mar-2021 06:04:56

459 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 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 ... Read More

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

AmitDiwan
Updated on 13-Mar-2021 06:02:31

617 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.Another class needs to be created that would have an initialization function, and the head of the node would be initialized ... Read More

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

AmitDiwan
Updated on 13-Mar-2021 06:00:40

322 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 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 ... Read More

Python program to delete a node from the middle of the Circular Linked List

AmitDiwan
Updated on 13-Mar-2021 06:00:14

217 Views

When it is required to delete a node from 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.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 delete a node from the end of the Circular Linked List

AmitDiwan
Updated on 13-Mar-2021 05:56:52

373 Views

When it is required to delete a node from the end 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.Another 'linked_list' class needs to be created that would have an initialization function, and the head of the node would be initialized ... Read More

Python Program to Print an Inverted Star Pattern

Akshitha Mote
Updated on 22-Jan-2025 13:43:18

1K+ Views

In this article, let's try to print an inverted star pattern. This pattern involves publishing a series of stars(*) in each line arranged in a descending order. For example, if the N=5 then the output should be − ***** **** *** ** * For printing star (*) patterns frequently, we use for loops. Let's discuss the for loop in Python. Python for loop The for loop in Python provides the ability to loop over the items of any sequence, such as a list, tuple, or string. It performs the same action on each item of the sequence. This ... Read More

Advertisements