Gireesha Devara

Gireesha Devara

174 Articles Published

Articles by Gireesha Devara

174 articles

Python program to Count Uppercase, Lowercase, special character and numeric values using Regex

Gireesha Devara
Gireesha Devara
Updated on 27-Mar-2026 1K+ Views

Regular expressions, commonly known as re or Regex is a powerful tool for manipulating and searching for patterns in text. In Python, regular expressions are implemented using the re module. A regular expression is a sequence of characters that define a search pattern used to match and manipulate text strings for tasks such as data cleaning, parsing, and validation. To count the number of uppercase letters, lowercase letters, special characters, and numeric values in a string using regular expressions, we use specific patterns to match and count the desired characters. Regex Patterns for Character Counting Uppercase ...

Read More

Python program to display half diamond pattern of numbers with star border

Gireesha Devara
Gireesha Devara
Updated on 27-Mar-2026 1K+ Views

A half-diamond pattern is a geometric pattern that resembles the shape of a diamond, but only covers half of the diamond. Diamond patterns can be created using loops in programming. By controlling the loops and the number of characters printed in each row, we can modify the pattern to achieve different shapes and arrangements. In this article, we will write a Python program that displays a half-diamond pattern of numbers with a star border. Input Output Scenarios Let's explore some input-output scenarios for displaying the half-diamond pattern of numbers with a star border. Scenario 1 ...

Read More

Python program to determine if the given IPv4 Address is reserved using ipaddress module

Gireesha Devara
Gireesha Devara
Updated on 27-Mar-2026 402 Views

In the traditional IPv4 addressing scheme, IP addresses are divided into five classes: A, B, C, D, and E. Class E addresses, ranging from 240.0.0.0 to 255.255.255.255, are designated for particular purposes and are not intended for general use in the current internet infrastructure. As a result, Class E addresses are considered "reserved" and are not allocated or routable on the public internet. To determine if a given IPv4 address falls within one of the reserved IP address ranges defined by organizations like the Internet Engineering Task Force (IETF) and the Internet Assigned Numbers Authority (IANA), Python utilizes the ...

Read More

Python program to determine if the given IP Address is Public or Private using ipaddress module

Gireesha Devara
Gireesha Devara
Updated on 27-Mar-2026 2K+ Views

In computer networking, IP addresses are used to uniquely identify devices connected to a network. IP addresses can be classified as either public or private. Public IP addresses are assigned to devices that are directly connected to the Internet. They are globally routable and can be accessed from anywhere on the Internet. Private IP addresses, on the other hand, are used within private networks, such as local area networks (LANs) or home networks. These IP addresses are not directly accessible from the Internet. Private IP addresses are defined by certain reserved address ranges specified by the Internet Engineering ...

Read More

Python Program to create an OTP by squaring and concatenating the odd digits of a number

Gireesha Devara
Gireesha Devara
Updated on 27-Mar-2026 376 Views

The task is to create a One-Time Password (OTP) by squaring and concatenating the odd digits of a given number. This technique extracts odd digits from a number, squares each one, and joins them together to form a secure OTP. Input Output Scenarios Following are the input-output scenarios for creating an OTP by squaring and concatenating the odd digits of a number ? # Example 1 number = 123456789 print(f"Input number: {number}") # Extract odd digits: 1, 3, 5, 7, 9 # Square them: 1, 9, 25, 49, 81 # Concatenate: "19254981" otp = "19254981" ...

Read More

Python program to create a list centered on zero

Gireesha Devara
Gireesha Devara
Updated on 27-Mar-2026 366 Views

Creating a list centered on zero involves generating a sequence of numbers where zero is positioned in the middle of the list. While the size of the list can be customized, it is often preferred to use an odd number to ensure symmetrical distribution of elements around zero. In this article, we will discuss different approaches to creating a list centered on zero using Python programming. Approach We can follow the below steps to create a centered list: Determine the desired size of the list. Let's call this value n. If n is an odd ...

Read More

Python program to convert meters in yards and vice versa

Gireesha Devara
Gireesha Devara
Updated on 27-Mar-2026 458 Views

A meter is the fundamental unit of length in the International System of Units (SI) and is used worldwide. It is defined as the length of the path traveled by light in a vacuum during a time interval of 1/299, 792, 458 of a second. Meters are commonly used in scientific, engineering, and everyday contexts. The yard, on the other hand, is a unit of length commonly used in both the British imperial and US customary systems of measurement. It is an English unit defined as 3 feet or 36 inches. It is defined as exactly 0.9144 meters. Yards ...

Read More

Python Program to Count Vowels, Lines, and Characters in Text File

Gireesha Devara
Gireesha Devara
Updated on 27-Mar-2026 5K+ Views

When working with text processing and analysis tasks, it is frequently required to count the vowels, lines, and characters in a text file. The goal is to determine the total counts of vowels, lines, and characters present in the file. Python provides various methods and techniques that can be used to accomplish these counting tasks effectively and efficiently. In this article, we will discuss different approaches for counting vowels, lines, and characters in a text file using Python programming. Approach By following the below steps, we can effectively count the vowels, lines, and characters in a text ...

Read More

Python program to count the number of blank spaces in a text file

Gireesha Devara
Gireesha Devara
Updated on 27-Mar-2026 2K+ Views

Blank spaces in a text file refer to the empty spaces or gaps between words, sentences, or characters. These spaces are typically represented by the space character (' ') or other whitespace characters, including tab ('\t'), newline (''), carriage return ('\r'), form feed ('\f'), and vertical tab ('\v'). These characters, as per the Unicode standard, represent empty space or formatting elements in the text. When counting the number of blank spaces in a text file, we are essentially looking for these whitespace characters to determine the frequency or distribution of spaces within the text. This information can be useful ...

Read More

Python program to convert float to exponential

Gireesha Devara
Gireesha Devara
Updated on 27-Mar-2026 5K+ Views

Float to exponential conversion transforms a decimal number into scientific notation (e.g., 1.23e+05). This format is useful for expressing very large or small numbers concisely in scientific calculations. Python provides three main approaches for converting floats to exponential notation: format() function, f-string formatting, and str.format() method. All use the 'e' format specifier to display numbers in scientific notation. Input Output Examples Here are common scenarios for float to exponential conversion ? Input: 1203100323.8932872122 Output: 1.203100e+09 Input: 0.0000123456789 Output: 1.23456789e-05 Input: 9876543.21 Output: 9.87654321e+06 The exponential notation shows the coefficient (significant digits) ...

Read More
Showing 1–10 of 174 articles
« Prev 1 2 3 4 5 18 Next »
Advertisements