Server Side Programming Articles

Page 101 of 2109

Python - K length consecutive characters

Asif Rahaman
Asif Rahaman
Updated on 27-Mar-2026 2K+ Views

Consecutive characters are those characters that appear one after the other. K-length consecutive characters mean the same character appearing k times consecutively. In this article, we will explore several methods to find such patterns using brute force, regular expressions, sliding windows, and NumPy arrays. Using the Brute Force Method The brute force approach checks every possible substring of length k to see if all characters are the same − Initialize an empty list to store results Iterate through the string, checking n-k+1 positions Extract k-length substrings and check if all characters are identical Use a set ...

Read More

Python - K length Combinations from given characters

Asif Rahaman
Asif Rahaman
Updated on 27-Mar-2026 525 Views

K length combinations from given characters mean the combinations of characters that we can create with the given characters, which are exactly of length k. In this article, we will explore several methods to achieve this, like recursion, map and lambda function, itertools library, etc. While recursion and lambda functions are custom functions, the itertools provide the in-built method to generate the combinations. Using Recursion Recursion is a programming technique where we break a large problem into smaller chunks. We need to define a base case to stop the recursion and prevent infinite loops. Example In ...

Read More

Python - Get Function Signature

Asif Rahaman
Asif Rahaman
Updated on 27-Mar-2026 2K+ Views

Understanding function signatures in Python is essential for analyzing function parameters, data types, and default values. The inspect module provides powerful methods like signature() and getfullargspec() to retrieve detailed function information programmatically. Using inspect.signature() Method The inspect.signature() method provides comprehensive access to function parameter details including annotations, default values, and parameter kinds ? Example import inspect def my_function(arg1: int, arg2: str = "default", *args: int, **kwargs: float) -> bool: pass signature = inspect.signature(my_function) params = signature.parameters for name, param in params.items(): print(f"Parameter: {name}") ...

Read More

Python - Get Even indexed elements in Tuple

Asif Rahaman
Asif Rahaman
Updated on 27-Mar-2026 575 Views

Getting even-indexed elements from a tuple means extracting elements at positions 0, 2, 4, 6, etc. Python provides several efficient approaches to accomplish this task using slicing, list comprehension, and functional programming methods. Using range() with List Conversion We can iterate through the tuple using range() with a step of 2, collect even-indexed elements in a list, then convert back to a tuple ? def get_even_elements(t): even_elements = [] for i in range(0, len(t), 2): even_elements.append(t[i]) ...

Read More

How to Replace the Kth word in a String using Python?

Asif Rahaman
Asif Rahaman
Updated on 27-Mar-2026 291 Views

Replacing the kth word in a string is a common string manipulation task in Python. This involves identifying the word at a specific position (k) and substituting it with a new word. Python offers several approaches using built-in methods like split(), list comprehension, and regular expressions. Using Split Method and Indexing The simplest approach uses split() to convert the string into a list of words, then directly accesses the kth word using indexing. Syntax string.split(delimiter) The split() method divides a string based on a delimiter (space by default) and returns a list of ...

Read More

How to Get the list of Running Processes using Python?

Asif Rahaman
Asif Rahaman
Updated on 27-Mar-2026 9K+ Views

The operating system runs with hundreds of tasks/processes at a single time. As a Python developer, this is important because often while dealing with programs that consume huge amounts of memory, we may want to delete some unimportant tasks. This article will explore how to get the running process list using Python. Using psutil Module The psutil module is a powerful cross−platform library for system monitoring and process management in Python. It provides a convenient and consistent API to access system−related information, such as CPU usage, memory utilization, disk usage, network statistics, etc. Being cross−platform, the same code ...

Read More

Locating multiple elements in Selenium Python

Siva Sai
Siva Sai
Updated on 27-Mar-2026 639 Views

Selenium is a powerful web automation tool that allows you to control web browsers programmatically. One of its key features is the ability to locate and interact with multiple elements on a webpage simultaneously. This tutorial covers how to find multiple elements using Selenium with Python. Setting Up Selenium First, install Selenium using pip and set up the WebDriver ? pip install selenium You'll also need to download a browser driver (like ChromeDriver for Chrome) and ensure it's in your system PATH or specify its location in your code. Modern Element Location Methods ...

Read More

Loan Eligibility Prediction using Machine Learning Models in Python

Siva Sai
Siva Sai
Updated on 27-Mar-2026 1K+ Views

Predicting loan eligibility is a crucial part of the banking and finance sector. It is used by financial institutions, especially banks, to determine whether to approve a loan application. A number of variables are taken into consideration, including the applicant's income, credit history, loan amount, education, and employment situation. In this article, we will demonstrate how to predict loan eligibility using Python and its machine learning modules. We'll introduce some machine learning models, going over their fundamental ideas and demonstrating how they can be used to generate predictions. Understanding the Problem Predicting whether a loan will be ...

Read More

Loan Calculator using PyQt5 in Python

Siva Sai
Siva Sai
Updated on 27-Mar-2026 463 Views

Welcome to this comprehensive guide on building a Loan Calculator using PyQt5 in Python. PyQt5's powerful GUI capabilities allow us to create an intuitive interface for loan calculations with input validation and real-time results. Introduction to PyQt5 PyQt5 is a cross-platform toolkit for creating desktop applications in Python. It provides Python bindings for Qt libraries, combining Python's simplicity with Qt's robust GUI components. PyQt5 is widely used for developing professional desktop applications. Loan Calculator Overview A loan calculator computes monthly payments and total repayment amounts based on loan principal, interest rate, and term. By providing a ...

Read More

How to Get the Last N characters of a String in Python

Asif Rahaman
Asif Rahaman
Updated on 27-Mar-2026 5K+ Views

Getting the last N characters from a string is a common task in Python programming. This is useful for file extensions, data validation, text processing, and many other applications. Python provides several approaches to extract the last N characters efficiently. Using String Slicing (Recommended) String slicing is the most Pythonic and efficient method to get the last N characters. It uses negative indexing where -n: starts from the nth character from the end. Example def get_last_n_characters(text, n): return text[-n:] text = "Hello, world!" n = 5 result = get_last_n_characters(text, n) ...

Read More
Showing 1001–1010 of 21,090 articles
« Prev 1 99 100 101 102 103 2109 Next »
Advertisements