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
Server Side Programming Articles - Page 2536 of 2650
1K+ Views
First, find the reverse of the string to check if a string is a palindrome or not −Array.reverse()Now use the equals() method to match the original string with the reversed. If the result is true, that would mean the string is Palindrome.Let us try the complete example. Here, our string is “Madam”, which is when reversed gives the same result −Example Live Demousing System; namespace Demo { class Program { static void Main(string[] args) { string string1, rev; string1 = "Madam"; char[] ch = string1.ToCharArray(); ... Read More
293 Views
Comments are used for explaining the code. Compilers ignore the comment entries. The multiline comments in C# programs start with /* and terminate with the characters */ as shown below.Multi-line comments/* The following is a multi-line comment In C# /*The /*...*/ is ignored by the compiler and it is put to add comments in the program.Single line comments// variable int a = 10;The following is a sample C# program showing how to add single-line as well as multi-line comments −Example Live Demousing System; namespace HelloWorldApplication { class HelloWorld { static void Main(string[] args) { ... Read More
704 Views
In C#, a structure is a value type data type. It helps you to make a single variable hold related data of various data types. The struct keyword is used for creating a structure.When you define a class, you define a blueprint for a data type.The following are the differences between classes and structures in C# −Classes are reference types and structs are value typesUnlike classes, structures cannot inherit other structures or classes.Structures cannot be used as a base for other structures or classes.When you create a struct object using the New operator, it gets created and the appropriate constructor ... Read More
3K+ Views
The use of the symbol * (asterisks) in writing or printing as a reference mark, a sign that some letters or words have been omitted, a way to indicate a possible but unproven linguistic form, or for other arbitrary purposes. In this article we will discuss different ways to replace a word with asterisks in a sentence in Python. Input-Output Scenarios Following is an input and its output scenario of replacing a word in a sentence with asterisks − Input: Welcome to the TutorialsPoint family. Output: Welcome to the TutorialsPoint ****** We can see in the above scenario that ... Read More
668 Views
We want to replace a character a1 with a character a2 and a2 with a1. For example, For the input string, "puporials toinp"and characters p and t, we want the end string to look like −"tutorials point"For this we can use map function and lambdas to make the replacement. The map(lambda, input) function iterates over each item passed to it(in form of iterable input) and apply the lambda expression to it. So we can use it as follows −Example Live Demodef replaceUsingMapAndLambda(sent, a1, a2): # We create a lambda that only works if we input a1 or a2 and swaps them. ... Read More
809 Views
In this article, we are going to learn how to use the map() function along with dictionaries to add the ASCII values of characters in the string. The Python built-in ord() function returns the ASCII integer value of a character. Additionally, dictionaries (dict) in Python are used to store key-value pairs. We use them to associate strings with their total ASCII values, making it easy to store and retrieve the result. Before diving into the examples, let's have a quick look at the Python map() function and the Python ord() function. Python map() Function The Python map() function ... Read More
773 Views
To remove all duplicates from a string in python, we need to first split the string by spaces so that we have each word in an array. Then there are multiple ways to remove duplicates.We can remove duplicates by first converting all words to lowercase, then sorting them and finally picking only the unique ones. For example, Examplesent = "Hi my name is John Doe John Doe is my name" # Seperate out each word words = sent.split(" ") # Convert all words to lowercase words = map(lambda x:x.lower(), words) # Sort the words in order words.sort() ... Read More
869 Views
Given a character sequence and a defined document unit, tokenization is the task of chopping it up into pieces, called tokens, perhaps at the same time throwing away certain characters, such as punctuation. In the context of nltk and python, it is simply the process of putting each token in a list so that instead of iterating over each letter at a time, we can iterate over a token.For example, given the input string −Hi man, how have you been?We should get the output −['Hi', 'man', ', ', 'how', 'have', 'you', 'been', '?']We can tokenize this text using the word_tokenize ... Read More
829 Views
In NLP(Natural Language Processing), stop words are the words that are filtered out before or after processing text data, such as "is", "and", "a" etc. These words do not add meaning to the text and can be removed to improve the efficiency. The Natural Language Toolkit (NLTK) is the python library that provides the easy to use interface and the tools for text processing such as tokenization and stop word removal. In this article, we will explore how to remove stop words using NLTK. NLTK Stop Words Before going to use the NLTK stop words, we have ... Read More
1K+ Views
In order to sort the words of a sentence in ascending order, we first need to split the sentence into words using space as the splitting point. For simplicity, we'll only be splitting on space and let the punctuation be there. We can use replace or regex to remove that as well.Once we split the sentence, we can sort the words lexicographically(like in a language dictionary) using either sort or sorted methods depending on whether we want to sort the array in place or sort it, then return a new array.In place sorting: when we want to sort the array/list ... Read More