
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 33676 Articles for Programming

1K+ 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

155 Views
In this problem, we will check if it is possible to divide the given numeric string into two disjoint subsequences such that sum(sub1) * sum(sub2) becomes odd. We need to divide the string into two subsequences such that the sum of the digits of both becomes odd to get the odd multiplication result. Problem statement − We have given a string num_string containing the numeric characters. We need to check whether we can divide the string into two subsequences such that the multiplication of the sum of both subsequences becomes odd. Also, it is given that every character of the ... Read More

865 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

358 Views
The problem statement includes counting the odd numbers in N−th row of Pascal’s triangle. A pascal’s triangle is a triangular array where each row represents the binomial coefficients in the expansion of binomial expression. The Pascal’s triangle is demonstrated as below: 1 1 ... Read More

1K+ 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

291 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

2K+ 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

287 Views
The problem statement includes printing the first N terms of the Moser−de Bruijn Sequence where N will be given in the user input. The Moser−de Bruijn sequence is a sequence consisting of integers which are nothing but the sum of the different powers of 4 i.e. 1, 4, 16, 64 and so on. The first few numbers of the sequence include 0, 1, 4, 5, 16, 17, 20, 21, 64....... The sequence always starts with zero followed by the sum of different powers of 4 such as $\mathrm{4^{0}}$ i.e $\mathrm{4^{1}\:i.e\:4, }$ then sum of $\mathrm{4^{0}\:and\:4^{1}\:i.e\:5}$ and so on. In this ... Read More

285 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

164 Views
The problem statement includes using Vantieghems theorem for primality test i.e. we will check for a positive number N which will be user input and print if the number is a prime number or not using the Vantieghems theorem. Vantieghem’s Theorem The Vantieghems theorem for primality states that a positive number, N is a prime number if the product of $\mathrm{2^{i}−1}$ where the value of i ranges from 1 to N−1 is congruent to N modulo $\mathrm{2^{N}−1}$ If both the values are congruent then the number N is a prime number else it is not a prime number. Congruent ... Read More