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
Server Side Programming Articles
Page 113 of 2109
Python program to extract a single value from JSON response
Value extraction is a very popular programming concept and it is used in a wide variety of operations. However extracting values from a JSON response is a different concept all together. It helps us to build logic and target specific values in a complex dataset. This article will explain the various methods that can be used to extract a single value from a JSON response. What is a JSON Response? A JSON (JavaScript Object Notation) response is a widely accepted data format through which a server responds to a client's request. Whenever a client requests for certain APIs ...
Read MorePython program to equal character frequencies
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 MorePython program to draw a bar chart using turtle
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 MorePython program to divide dictionary and its keys into K equal dictionaries
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 MoreAppJar Module in Python
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 MorePython Program To Write Your Own atoi()
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 MorePython Program to Print the first letter of each word using regex
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 MorePython Program to Determine the Unicode Code Point at a given index
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 MorePython Program to Compare two strings lexicographically
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 MoreHow to Save Pandas Dataframe as gzip/zip File?
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