Pradeep Elance

Pradeep Elance

317 Articles Published

Articles by Pradeep Elance

Page 22 of 32

How to create an Animated Art on Your Linux Terminal?

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 4K+ Views

Linux terminals can display animated art using ASCII characters and specialized packages. These animations range from simple moving text to complex scenes like trains and castles, created using shell scripting and command-line utilities. Installing and Running the Steam Locomotive The sl package creates a fun train animation that "runs" across your terminal screen. Install it using the package manager and execute with a simple command ? sudo apt-get install sl sl Running the above code displays an animated steam locomotive moving across your terminal ? Creating ASCII Castle Animation You ...

Read More

How to Create a New Ext4 File System in Linux?

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 6K+ Views

Creating a new Ext4 file system in Linux involves formatting a partition with the Ext4 file system type. This is essential when adding new storage or repurposing existing partitions. In this tutorial, we'll explore how to identify available file systems, examine current partitions, and format a partition with Ext4. Available Filesystem Types First, let's check what file system tools are available on your system. The following command lists all the file system creation utilities ? $ ls -1 /sbin/mkfs* /sbin/mkfs /sbin/mkfs.bfs /sbin/mkfs.cramfs /sbin/mkfs.ext2 /sbin/mkfs.ext3 /sbin/mkfs.ext4 /sbin/mkfs.ext4dev /sbin/mkfs.fat /sbin/mkfs.minix /sbin/mkfs.msdos /sbin/mkfs.ntfs /sbin/mkfs.vfat ...

Read More

How to Change or Set System Locales in Linux

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 3K+ Views

We often need to customise the operating system to match our preferences like the language we want to use, the time zone we are in, or the type of currency which would become the default in the OS. In this article we will see how to customise these options which is known as locale. Checking Current Locale We can check the current locale by using the locale command as shown below. We get a list of variables which can be reset to different values as per our choice ? $ locale Running the above ...

Read More

Display Command Output or File Contents in Column Format in Linux

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 792 Views

When working with files containing multiple columns, data can appear cramped and difficult to read. The column command in Linux helps format text into readable columns with proper spacing and alignment, making data analysis much easier. Sample File Let's examine a sample CSV file with iris dataset that we'll use to demonstrate the column command ? $ cat iris.data The output shows cramped CSV data ? Id, SepalLengthCm, SepalWidthCm, PetalLengthCm, PetalWidthCm, Species 1, 5.1, 3.5, 1.4, 0.2, Iris-setosa 2, 4.9, 3.0, 1.4, 0.2, Iris-setosa 3, 4.7, 3.2, 1.3, 0.2, Iris-setosa 4, 4.6, ...

Read More

Add trailing Zeros to a Python string

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 4K+ Views

When processing strings in Python, you may need to add trailing zeros for formatting purposes such as padding numbers or creating fixed-width strings. Python provides several methods to accomplish this task efficiently. Using ljust() Method The ljust() method returns a string left-justified within a specified width, padding with a given character. Combined with len(), it allows dynamic zero padding ? Example # Add trailing zeros to a Python string # initializing string text = 'Jan-' print("The given input: " + text) # Number of zeros required n = 3 # Using ljust() to ...

Read More

Programs for printing pyramid patterns in Python

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 2K+ Views

Taking advantage of the for loop and range function in Python, we can draw a variety of pyramid structures. The key to the approach is designing the appropriate for loop which will leave both vertical and horizontal space for the position of the symbol we choose for drawing the pyramid structure. Pattern 1: Right-Angled Triangle We draw a right angle based pattern where each row contains an increasing number of stars ? def pyramid(p): for m in range(0, p): for n in range(0, m+1): ...

Read More

Program to make Indian Flag in Python

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 3K+ Views

Python's libraries for drawing graphs have very extensive features which can not only give us charts but also provide flexibility to draw other diagrams like flags. In that sense, those modules have an artistic touch. In this article we will see how to draw the Indian flag using the libraries NumPy and Matplotlib. Approach Create three rectangles of same width and draw them with appropriate colors and borders representing the tricolor. Use pyplot function to draw the circle of the Ashoka Chakra at the center of the middle rectangle. ...

Read More

Program to create grade calculator in Python

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 3K+ Views

In academics, it is a common requirement to calculate student grades based on their assessment scores. In this article, we will create a Python program that assigns grades using a predefined grading criteria. Grading Criteria Below is the grading criteria used in our program − Score >= 90 : "O" (Outstanding) Score >= 80 : "A+" (Excellent) Score >= 70 : "A" (Very Good) Score >= 60 : "B+" (Good) Score >= 50 : "B" (Above Average) Score >= 40 : "C" (Average) Score < 40 : "F" (Fail) Program Structure Our ...

Read More

Print number with commas as 1000 separators in Python

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 599 Views

Numbers with three or more digits often need to be displayed with commas for better readability, especially in accounting and finance applications. Python provides several methods to format numbers with commas as thousand separators. Using f-strings (Python 3.6+) The most modern approach uses f-string formatting with the comma specifier ? # Format integers with commas num1 = 1445 num2 = 140045 num3 = 5000000 print(f'{num1:, }') print(f'{num2:, }') print(f'{num3:, }') 1, 445 140, 045 5, 000, 000 Formatting Float Numbers For floating-point numbers, specify the decimal precision along with ...

Read More

Print first n distinct permutations of string using itertools in Python

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 471 Views

When working with permutations of strings that contain duplicate characters, we often need to find only the distinct permutations. Python's itertools.permutations() generates all possible arrangements, including duplicates, so we need additional logic to filter unique results. Syntax from itertools import permutations def get_distinct_permutations(string, n): # Sort characters to group duplicates together sorted_chars = sorted(list(string)) # Generate all permutations all_perms = permutations(sorted_chars) # Use set to store ...

Read More
Showing 211–220 of 317 articles
« Prev 1 20 21 22 23 24 32 Next »
Advertisements