Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Programming Articles
Page 415 of 2547
How to draw different shapes using the Python Turtle library?
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 MorePython program to compare two Pandas series
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 MoreHow to maximize a plt.show() window using Python?
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 MoreHow to make two plots side-by-side using Python?
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 MoreSaving images in Python at a very high quality
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 MorePython program to remove duplicate elements from a Circular Linked List
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 MorePython program to insert a new node at the middle of the Circular Linked List
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 MorePython program to insert a new node at the end of the Circular Linked List
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 MorePython program to insert a new node at the beginning of the Circular Linked List
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 MorePython program to find the maximum and minimum value node from a circular linked list
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