Programming Articles

Page 117 of 2547

Python program to equal character frequencies

Devesh Chauhan
Devesh Chauhan
Updated on 27-Mar-2026 219 Views

Python provides numerous built-in functions for string manipulation and analysis. In this article, we'll explore how to modify an input string to equalize character frequencies, ensuring each character appears the same number of times as the most frequent character. Understanding the Problem Our task is to modify a string so that each character has equal frequencies. We find the maximum occurring character and adjust all other characters to match that frequency. Example Scenario Consider this input string: input_str = "thisisateststring" print("Original string:", input_str) # Count character frequencies from collections import Counter freq = ...

Read More

Python program to draw a bar chart using turtle

Devesh Chauhan
Devesh Chauhan
Updated on 27-Mar-2026 1K+ Views

Graphical representation of data provides an enhanced understanding of complex sub-structures and helps us easily interpret hidden patterns and trends. Python offers a built-in module called turtle that allows us to create visual graphics programmatically. The turtle module is a built-in Python library that enables drawing graphics on a turtle graphics screen. In this article, we will create a bar chart using the turtle module ? Understanding the Turtle Module The turtle module uses a virtual turtle object to create graphics. This turtle can move around the screen and draw shapes. Let's explore the key functions needed ...

Read More

Python program to divide dictionary and its keys into K equal dictionaries

Devesh Chauhan
Devesh Chauhan
Updated on 27-Mar-2026 557 Views

A dictionary is a unique data structure in Python that stores data as key-value pairs, where each key is a unique identifier used to access its corresponding value. We can perform various operations on dictionaries to manipulate the stored data. This article explains how to divide a dictionary into K equal dictionaries where each value is divided by K, and K represents the number of keys in the original dictionary. Understanding the Problem Given a dictionary, we need to create K copies where each value is divided by K (the total number of keys). Let's understand this ...

Read More

AppJar Module in Python

Priya Mishra
Priya Mishra
Updated on 27-Mar-2026 926 Views

The Python AppJar module simplifies GUI development by providing an easy-to-use interface for creating graphical user interfaces. AppJar comes with pre-built widgets such as buttons, labels, text boxes, and dropdown menus, making it perfect for both beginners and experienced developers. What is AppJar Module? The AppJar module is a user-friendly toolkit that makes designing Graphical User Interfaces (GUIs) in Python easier. It provides a straightforward and efficient way to design GUI applications without extensive coding knowledge. Installation Install AppJar using pip package manager ? pip install appJar Once installed, import the AppJar ...

Read More

Python Program To Write Your Own atoi()

Prabhdeep Singh
Prabhdeep Singh
Updated on 27-Mar-2026 630 Views

We are given a string that may represent a number and need to convert it into an integer using Python. The atoi() function is used in C programming to convert a string parameter into an integer value if the string is a valid integer, otherwise it shows undefined behavior. Sample Examples Input 1 string S = "9834" Output 9834 Explanation: The string represents a valid number, so we get the same output as an integer. Input 2 string S = "09 uy56" Output ...

Read More

Python Program to Print the first letter of each word using regex

Rohan Singh
Rohan Singh
Updated on 27-Mar-2026 3K+ Views

Regular expressions (regex) in Python provide powerful pattern-matching capabilities for text manipulation. We can extract the first letter of each word using regex patterns that identify word boundaries. In this article, we will explore different approaches to print the first letter of each word using regex. Regular Expressions Overview Regular expressions are sequences of characters that define search patterns. They are widely used for text processing tasks like validation, extraction, and manipulation. Python's re module provides comprehensive regex functionality. Method 1: Using findall() with Word Boundaries The re.findall() method finds all non-overlapping matches of a pattern ...

Read More

Python Program to Determine the Unicode Code Point at a given index

Rohan Singh
Rohan Singh
Updated on 27-Mar-2026 5K+ Views

A Unicode code point is a unique number that represents a character in the Unicode standard. Unicode supports over 130, 000 characters including letters, symbols, and emojis. Python provides several methods to determine the Unicode code point at a specific index: ord() function, codecs module, unicodedata module, and array module. What is a Unicode Code Point? Every Unicode character has a unique numeric identifier called a code point. Code points are represented in hexadecimal notation with a "U+" prefix followed by a four or more digit hexadecimal number (e.g., U+0065 for 'e'). Method 1: Using ord() Function ...

Read More

Python Program to Compare two strings lexicographically

Rohan Singh
Rohan Singh
Updated on 27-Mar-2026 5K+ Views

We can compare two strings lexicographically in Python using comparison operators like , ==, =. Lexicographic comparison is the process of comparing two strings based on their alphabetical order, similar to how words are arranged in a dictionary. Algorithm A generalized algorithm to compare two strings lexicographically is as follows − Initialize two strings with the values to be compared. Compare the first character of both strings. If they are equal, move to the next character and repeat. If they are not equal, proceed to step 3. Determine which character comes first alphabetically. The string with ...

Read More

How to Save Pandas Dataframe as gzip/zip File?

Rohan Singh
Rohan Singh
Updated on 27-Mar-2026 7K+ Views

Pandas DataFrames can be saved in compressed gzip/zip format to reduce file size and improve storage efficiency. Python provides multiple approaches using gzip, zipfile modules, and built-in compression parameters in pandas methods. Method 1: Using to_csv() with Built-in Compression The simplest approach is using pandas' built-in compression parameter with to_csv() ? Saving as Gzip File import pandas as pd # Create a DataFrame data = {'Name': ['Alice', 'Bob', 'Charlie'], 'Age': [25, 30, 35], 'Salary': [50000, 60000, 70000]} df ...

Read More

How to Run Python Flask App Online using Ngrok?

Rohan Singh
Rohan Singh
Updated on 27-Mar-2026 6K+ Views

Ngrok is a tool that creates a secure tunnel between your local machine and the internet. It allows developers to expose their local web server to the internet without deploying it to a remote server. Python Flask lets you create web applications locally, but with Ngrok, you can showcase them online instantly. Step 1: Install Ngrok Download Ngrok from its official website (https://ngrok.com/download) for your operating system (Windows/macOS/Linux). Extract the archive to your preferred folder location. Step 2: Create a Flask App Create a new Python file called app.py with a simple Flask application ? ...

Read More
Showing 1161–1170 of 25,466 articles
« Prev 1 115 116 117 118 119 2547 Next »
Advertisements