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
Articles by karthikeya Boyini
Page 2 of 142
Pattern matching in Python with Regex
Regular expressions (regex) are a powerful tool for pattern matching and string manipulation in Python. The re module provides comprehensive regex functionality for finding, matching, and replacing text patterns. What is Regular Expression? A regular expression is a sequence of characters that defines a search pattern. In Python, the re module handles string parsing and pattern matching. Regular expressions can answer questions like ? Is this string a valid URL? Which users in /etc/passwd are in a given group? What is the date and ...
Read MoreWhy is python best suited for Competitive Coding
Competitive programming involves solving algorithmic problems efficiently using appropriate data structures within time constraints. Programmers must not only solve problems correctly but also optimize for time and space complexity. Here's an example of a typical competitive programming problem ? Given a string s of length n with only lowercase letters, calculate the number of ways to remove exactly one substring so that all remaining characters are equal. You must remove at least one character. While any programming language can solve such problems, Python offers unique advantages for competitive coding. Development Speed Python significantly ...
Read MorePerforming Google Search using Python code?
In this article, we will learn how to perform Google searches using Python code. This is particularly useful when working on projects that need to access web data or integrate search results into your application. Prerequisites Python installed on your system Install the google module using pip ? pip install google Method 1: Getting Search Result URLs This approach returns a list of URLs from Google search results that you can use programmatically ? # Performing Google search and getting URLs class GoogleSearch: def __init__(self, ...
Read MorePython program to print all the numbers divisible by 3 and 5 for a given number
This Python program finds all numbers divisible by both 3 and 5 within a given range. Numbers divisible by both 3 and 5 are also divisible by their least common multiple (LCM), which is 15. Method 1: Using Modulo Operator with AND Condition We can check if a number is divisible by both 3 and 5 using the modulo operator ? lower = int(input("Enter lower range limit: ")) upper = int(input("Enter upper range limit: ")) print(f"Numbers divisible by both 3 and 5 between {lower} and {upper}:") for i in range(lower, upper + 1): ...
Read MoreImplementation of Dynamic Array in Python
In Python, dynamic arrays automatically resize when elements are added or removed. Python's built-in list is actually a dynamic array that can grow and shrink during runtime, unlike static arrays with fixed sizes. Understanding Mutable vs Immutable Objects Python objects fall into two categories ? Mutable: Lists, sets, and dictionaries can be modified after creation Immutable: Numbers, strings, and tuples cannot be changed after creation Python Lists as Dynamic Arrays Let's see how Python lists work as dynamic arrays ? # Create an empty list numbers = [] print(f"Type: {type(numbers)}") print(f"Initial ...
Read MoreExploratory Data Analysis in Python
Exploratory Data Analysis (EDA) is the critical first step in any data analysis project. It helps us understand our dataset's structure, identify patterns, and uncover relationships between variables before applying machine learning algorithms. What EDA Helps Us Achieve EDA provides valuable insights by helping us to − Gain insight into the dataset's characteristics Understand the underlying data structure Extract important parameters and relationships between variables Test underlying assumptions about the data Loading and Exploring the Dataset Let's perform EDA using the Wine Quality dataset from UCI Machine Learning Repository. We'll start by loading ...
Read MorePlotting Google Map using gmplot package in Python?
The gmplot library allows you to plot geographical data on Google Maps and save it as HTML files. It provides a matplotlib-like interface to generate interactive maps with markers, polygons, heatmaps, and other visualizations. Installation Install gmplot using pip if it's not already installed − pip install gmplot Creating a Basic Map To create a basic map, specify the latitude, longitude, and zoom level − # Import gmplot library import gmplot # Create map centered at specific coordinates # Parameters: latitude, longitude, zoom_level gmap = gmplot.GoogleMapPlotter(17.438139, 78.39583, 18) # ...
Read MoreFormatted text in Linux Terminal using Python
In this section, we will see how to print formatted texts in Linux terminal. By formatting, we can change the text color, style, and some special features using ANSI escape sequences. Linux terminal supports ANSI escape sequences to control the formatting, color and other features. We embed these special bytes with the text, and when the terminal interprets them, the formatting becomes effective. ANSI Escape Sequence Syntax The general syntax of ANSI escape sequence is ? \x1b[A;B;C Where: A is the Text Formatting Style B is the Text Color or Foreground ...
Read MoreGenerate a graph using Dictionary in Python
Graphs can be implemented using Dictionary in Python where each key represents a vertex and its value contains a list of connected vertices. This creates an adjacency list representation of a graph G(V, E). We'll use Python's defaultdict from the collections module, which provides additional features over regular dictionaries by automatically creating missing keys with default values. Graph Representation Consider this undirected graph with 6 vertices (A, B, C, D, E, F) and 8 edges ? A B ...
Read MoreTracking bird migration using Python-3
Bird migration tracking using GPS technology provides valuable insights into animal behavior patterns. Researchers use GPS modules to monitor how birds travel to different locations throughout the year, collecting data on their routes, timing, and movement patterns. In this tutorial, we'll analyze a bird tracking dataset containing GPS coordinates, timestamps, and movement data. The dataset is in CSV format with fields including bird ID, date_time, latitude, longitude, and speed. Required Libraries We need several Python libraries for data analysis and visualization. Install them using conda − conda install -c conda-forge matplotlib conda install -c anaconda ...
Read More