- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 27104 Articles for Server Side Programming
68 Views
In this problem, we need to increase each character of multiple prefixes of size given in the array. The naïve approach to solving the problem is to take each prefix of the size given in the array and increment each character of the prefix by 1. The best approach is to create the prefix array using the given array and update each string character in the single iteration. Problem statement − We have given a string alpha of length N. Also, we have given a prefixes array containing the positive integer. The prefixes[i] represent that take prefix of length prefixes[i] ... Read More
114 Views
Embarking on the vast domains of machine learning and data science, one encounters tasks that might appear inconsequential but hold a crucial position in the broader perspective. One such vital task is the division of data into training and validation sets - a foundational step for creating an effective predictive model. Scikit-learn, a prominent Python library for machine learning, boasts a versatile function, train_test_split(), crafted to address this task with remarkable ease. This treatise aims to steer you through the process of partitioning your data using scikit-learn's train_test_split() function. Syntax from sklearn.model_selection import train_test_split X_train, X_test, y_train, y_test = ... Read More
511 Views
In the domain of machine learning or artificial intelligence models, data stands as the backbone. The way this data gets handled shapes the holistic performance of the model. This includes the indispensable task of segregating the dataset into learning and verification sets. While sklearn's train_test_split() is a frequently employed method, there could be instances when a Python aficionado might not have it at their disposal or is curious to grasp how to manually attain a similar outcome. This discourse delves into how one can segregate data into learning and verification sets without leaning on sklearn. We will bank on Python's ... Read More
421 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. The pattern is used to match and manipulate text strings, which can be very useful 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 (regex), we can use specific patterns to match and count the desired characters. Following ... Read More
557 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 − Input: n = ... Read More
130 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 is_reserved ... Read More
898 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 Task Force ... Read More
133 Views
The task is to create a One-Time Password (OTP) by squaring and concatenating the odd digits of a given number. Input Output Scenarios Following are the input-output scenarios for creating an OTP by squaring and concatenating the odd digits of a number Input number = 123456789 Output OTP: 19254981 The odd digits in the number are 1, 3, 5, 7, 9. Squaring each of these digits gives us 1, 9, 25, 49, 81. Concatenating these squared digits together gives us the OTP 19254981. Input: 54321 Output: 2591 The odd digits in the input number are 5, 3, and ... Read More
129 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 the 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 number, it ... Read More
3K+ Views
Strings in Python can contain any sequence of characters, including letters, numbers, symbols, and whitespace. It can represent text, numbers, or any other type of data that can be represented as a sequence of characters. In Python, strings are enclosed in single quotes ('') or double quotes (""). Multiline strings can be created using triple quotes (''' or """). Here are a few examples of valid Python strings: "Hello, World!" "12345" "Python is awesome!" Counting the number of characters in a string involves determining the total count of individual characters within the string. Python offers various techniques for ... Read More