Pradeep Elance has Published 445 Articles

Generate two output strings depending upon occurrence of character in input string in Python

Pradeep Elance

Pradeep Elance

Updated on 19-Dec-2019 12:32:58

68 Views

In this program , we take a string and count the characters in it with certain condition. The first condition is to capture all those characters which occur only once and the second condition is to capture all the characters which occur more than once. Then we list them out.Below ... Read More

Find the first repeated word in a string in Python using Dictionary

Pradeep Elance

Pradeep Elance

Updated on 19-Dec-2019 12:30:11

1K+ Views

In a given sentence there may be a word which get repeated before the sentence ends. In this python program, we are going to catch such word which is repeated in sentence. Below is the logical steps we are going to follow to get this result.Splits the given string into ... Read More

Exploring Correlation in Python

Pradeep Elance

Pradeep Elance

Updated on 19-Dec-2019 12:26:02

417 Views

Correlation is a statistical term to measure the relationship between two variables. If the relationship is string, means the change in one variable reflects a change in another variable in a predictable pattern then we say that the variables are correlated. Further the variation in first variable may cause a ... Read More

Different messages in Tkinter - Python

Pradeep Elance

Pradeep Elance

Updated on 19-Dec-2019 12:22:14

280 Views

Tkinter is the GUI module of python. It uses various message display options which are in response to the user actions or change in state of a running program. The message box class is used to display variety of messages like confirmation message, error message, warning message etc.Example-1The below example ... Read More

destroy() method in Tkinter - Python

Pradeep Elance

Pradeep Elance

Updated on 19-Dec-2019 12:19:04

4K+ Views

The destroy() method in Tkinter destroys a widget. It is useful in controlling the behavior of various widgets which depend on each other. Also when a process is complete by some user action we need to destroy the GUI components to free the memory as well as clear the screen. ... Read More

Create a stopwatch using python

Pradeep Elance

Pradeep Elance

Updated on 19-Dec-2019 11:40:26

932 Views

A stopwatch is used to measure the time interval between two events usually in seconds to minutes. It has various usage like in sports or measuring the flow of heat, current etc in an industrial setup. Python can be used to creat a stopwatch by using its tkinter library.This library ... Read More

Count set bits using Python List comprehension

Pradeep Elance

Pradeep Elance

Updated on 19-Dec-2019 11:34:21

102 Views

Set bits are the bits representing 1 in the binary form of a number. In this article we will see how to count the number of set bits in a given decimal number.#53 in binary is: 110101 The number of set bits is the number of ones. Here it is ... Read More

Binary list to integer in Python

Pradeep Elance

Pradeep Elance

Updated on 19-Dec-2019 11:14:51

1K+ Views

We can convert a list of 0s and 1s representing a binary number to a decimal number in python using various approaches. In the below examples we use the int() method as well as bitwise left shift operator.Using int()The int() method takes in two arguments and changes the base of ... Read More

Find all the patterns of “1(0+)1” in a given string using Python Regex

Pradeep Elance

Pradeep Elance

Updated on 23-Oct-2019 08:22:30

159 Views

In this tutorial, we are going to write a program which finds all the occurrences of the 1(0+1) in a string using the regexes. We have a re module in Python which helps us to work with the regular expressions.Let's see one sample case.Input: string = "Sample 1(0+)1 string with ... Read More

Check if both halves of the string have the same set of characters in Python

Pradeep Elance

Pradeep Elance

Updated on 23-Oct-2019 08:20:20

86 Views

We have to check whether two halves of a string have the same set of characters or not in Python. The frequency of the characters in the two halves must be identical. If the length of the string is odd, ignore the middle and check for the remaining characters. Follow ... Read More

Advertisements