Karthikeya Boyini has Published 2383 Articles

Map function and Dictionary in Python to sum ASCII values

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 09:09:09

587 Views

We want to calculate the ASCII sum for each word in a sentence and the sentence as a whole using map function and dictionaries. For example, if we have the sentence −"hi people of the world"The corresponding ASCII sums for the words would be : 209 645 213 321 552And ... Read More

What MySQL ELT() function returns if the index number, provided as an argument, is higher than the number of strings?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 08:48:29

65 Views

MySQL ELT() function returns NULL as output if the index number provided as argument is higher than the number of strings. Following is an example to make it clearer −Examplemysql> Select ELT(6, 'Ram', 'is', 'a', 'good', 'boy')As Result; +--------+ | Result | +--------+ | NULL   | +--------+ 1 row ... Read More

Extracting email addresses using regular expressions in Python

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 08:41:36

5K+ Views

Email addresses are pretty complex and do not have a standard being followed all over the world which makes it difficult to identify an email in a regex. The RFC 5322 specifies the format of an email address. We'll use this format to extract email addresses from the text.For example, ... Read More

Python program to sort out words of the sentence in ascending order

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 08:29:57

990 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 ... Read More

Tokenize text using NLTK in python

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 08:27:52

692 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 ... Read More

Transmission of Light Through Fiber

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 08:23:07

5K+ Views

In fiber optic communication, signals are transmitted through an optical fiber. This is based upon certain characteristics of light, namely refraction and total internal reflection.RefractionWhen a light ray goes from a denser transmission medium to a rarer one or vice versa, then its direction changes at the interface of the ... Read More

Comparison of Fiber Optics and Copper Wire

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 08:22:26

4K+ Views

Fiber optic cables are finding increasing usage due to a number of advantages over the traditional copper wires. However, there are a few flipsides in its usage too.Advantages of Fiber Optics Cables over Copper WiresFiber optic cables transmit data at much higher speed than copper wires. This is because the ... Read More

Python Regex to extract maximum numeric value from a string

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 08:21:49

343 Views

The easiest way to extract the maximum numeric value from a string using regex is to −Use the regex module to extract all the numbers from a stringFind the max from these numbersFor example, for the input string −There are 121005 people in this city, 1587469 in the neighboring city ... Read More

What MySQL returns if sub-query, used to assign new values in the SET clause of UPDATE statement, returns multiple rows?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 07:07:57

218 Views

In this case, MySQL will return an error message because we know that if sub-query is used to assign new values in the SET clause of UPDATE statement then it must return exactly one row for each row in the update table that matches the WHERE clause.Examplemysql> insert into info(id, ... Read More

How can we sort MySQL output in ascending order?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 06:26:13

204 Views

We need to specify ASC (short form for ASCENDING) keyword in ORDER BY clause if we want to sort out the result set in ascending order.SyntaxSelect column1, column2, …, columN From table_name ORDER BY column1[column2, …] ASC;ExampleIn the following example, we have sorted the result set by column ‘Name’ in ... Read More

Advertisements