Pradeep Elance has Published 337 Articles

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

Pradeep Elance

Pradeep Elance

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

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

Different messages in Tkinter - Python

Pradeep Elance

Pradeep Elance

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

512 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

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

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

214 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

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

289 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

222 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

Calculate n + nn + nnn + … + n(m times) in Python program

Pradeep Elance

Pradeep Elance

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

2K+ Views

We are going to write a program that calculates the following series in Python. Examine the example inputs and outputs for the program that we are going to write.Input: 34 3 + 33 + 333 + 3333 Output: 3702Input: 5 5 5 + 55 + 555 + 5555 + 55555 ... Read More

FuzzyWuzzy Python library

Pradeep Elance

Pradeep Elance

Updated on 23-Oct-2019 08:01:52

819 Views

In this tutorial, we are going to learn about the FuzzyWuzzy Python library. FuzzyBuzzy library is developed to compare to strings. We have other modules like regex, difflib to compare strings. But, FuzzyBuzzy is unique in its way. The methods from this library returns score out of 100 of how ... Read More

Advertisements