
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

2K+ Views
In this article, we are going to learn how to display the hostname and IP address. Generally, the devices that connect to a network are identified by two things: Hostname: It is the name assigned to the device on a network. It helps users to identify devices in a human-readable format (e.g, mypc, desktop-pc, etc.) IP Address: It is the numerical address assigned to each device on a network, used to locate and communicate with that device. Python provides the built-in socket module for achieving this task, which provides access to various ... Read More

2K+ Views
In Python, every number is represented internally as a sequence of binary digits, known as bits. In this article, we are going to learn how to reverse the bits of a positive integer number. Reversing the bits of a Positive Integer Number If we reverse bits of an integer value, we are flipping the order of its binary digits such that the least important bit becomes the most important and vice versa. The Python bin() Function: The Python bin() function accepts an integer value and converts the given integer to its binary representation. Following is the syntax of this ... Read More

834 Views
Here we use different python inbuilt function. First we use bin() for converting number into it’s binary for, then reverse the binary form of string and compare with originals, if match then palindrome otherwise not. Example Input: 5 Output: palindrome Explanation Binary representation of 5 is 101 Reverse it and result is 101, then compare and its match with originals. So its palindrome Algorithm Palindromenumber(n) /* n is the number */ Step 1: input n Step 2: convert n into binary form. Step 3: skip the first two characters of a string. Step 4: them reverse the ... Read More

456 Views
Given the number, find length of the longest consecutive 1's in its binary representation. Example Input: n = 15 Output: 4 The binary representation of 14 is 1111. Algorithm Step 1: input the number. Step 2: use one counter variable c=0. Step 3: Count the number of iterations to reach i = 0. Step 4: This operation reduces length of every sequence of 1s by one. Example code # Python program to find # length of the longest # consecutive 1s in # binary representation of a number. def maxlength(n): # ... Read More

5K+ Views
In this article, we are going to learn about how to print the initials of a name with last name in full. For example, If we consider the applications like resumes or media references, it represents the person name using initials followed by the last name like instead of writing "Sai Vamsi Srinivas", we might write "S.V.Srinivas". This kind of formatting improves the readability and ensures the important part of the name(last name) is fully visible. Using Python split() and join() Methods The Python split() method is used to split all the words in the string by ... Read More

24K+ Views
In this article, we are going to learn about splitting the even and odd elements into two different lists. This involves looping each element in a list and checking whether it is divisible by 2. Even numbers are those that gives the remainder '0' when divided by 2, while the odd numbers leaves a remainder '1'. Using Python append() Method The Python append() method is used to add the new object to a list. It accepts an object as a argument and inserts it at the end of the existing list. Syntax Following is the syntax of Python ... Read More

1K+ Views
The SequenceMatcher class is the part of the Python difflib module. It is used to compare sequence (such as lists or strings) and finds the similarities between them. The task is to find the Longest Common Substring, i.e, the longest sequence of the characters that appears contiguously in both strings. which is different from the Longest Common Subsequence, where the characters may appear in the same order but not repeatedly. Using find_longest_match() Method The find_longest_match() method is used to find the longest matching sequence of elements between two sequences. It is the part of the Python difflib module. ... Read More

15K+ Views
In Python, Lists are one of the data types. It is sequence of comma separated items, enclosed in the square brackets []. They are widely used to store collection of item. In this article, we are going to learn about finding the maximum and minimum element's position in a list. This can be achieved by using the Python built-in functions like max(), min() and index(). Using Python max() Function The Python max() function is used to return the maximum element in the list. If the list contains the numbers, comparison is done numerically, but if the list contains strings, ... Read More

1K+ Views
In Python, the == and is operators are used for comparison, but they serve different purposes. The == operator checks for equality of values, which means it evaluates whether the values of two objects are the same. On the other hand, the is operator checks for identity, meaning it determines whether two variables point to the same object in memory. Before discussing the differences between the == and is operators in Python, let’s first understand these operators in detail. What Is the 'is' Operator? The Python is operator tests whether two variables refer to the same object in memory. If ... Read More

147 Views
Given a 26 letter character set, here we are using a new character set. And another character set just like alphabet set (a, b, c........z), then our task is to make a relation between new character set and that alphabet set. Example New character set: qwertyuiopasdfghjklzxcvbnm Input: "wwmm" Output: bbzy Algorithm Step 1: Given a new character set and input the string to make a relation. Step 2: and the original character set also given below. Step 3: Create a dictionary, we use here map technique, we map the English character set and new given character set, ... Read More