Programming Articles

Page 27 of 2547

Facebook Login using Python

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 1K+ Views

We can use the Python package called Selenium to automate web browser interactions. In this article, we will see how to automate Facebook login using Python's Selenium package. Prerequisites Before automating Facebook login, we need to set up Selenium and a web driver. Here are the required steps ? Step 1: Install Selenium Install the Selenium package in your Python environment ? pip install selenium Step 2: Install WebDriver Download ChromeDriver from the official website or install it using webdriver-manager ? pip install webdriver-manager Finding HTML Elements ...

Read More

Dictionary Methods in Python (cmp(), len(), items()...)

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 2K+ Views

Dictionary in Python is one of the most frequently used collection data types. It is represented by key-value pairs where keys are indexed but values may not be. There are many Python built-in functions that make using dictionaries very easy in various Python programs. In this topic we will see three built-in methods: cmp(), len(), and items(). cmp() Method The cmp() method compares two dictionaries based on keys and values. It is helpful in identifying duplicate dictionaries as well as doing relational comparisons among dictionaries. Note: This method is only available in Python 2 and has been removed ...

Read More

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

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 2K+ Views

In a given sentence, there may be a word which gets repeated before the sentence ends. In this Python program, we are going to find the first word that appears multiple times in a string using a dictionary approach. The logical steps we follow to get this result are: Split the given string into words separated by space Convert these words into a dictionary using collections.Counter Traverse the list of words and find the first word with frequency > 1 Using collections.Counter ...

Read More

Different messages in Tkinter - Python

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 522 Views

Tkinter is Python's built-in GUI toolkit that provides various message display options for user interactions and program state changes. The Message widget displays multi-line text with customizable formatting, while the messagebox module offers standard dialog boxes like confirmations, errors, and warnings. Custom Message Widget The Message widget displays text with customizable appearance ? import tkinter as tk main = tk.Tk() key = "The key to success is to focus on goals and not on obstacles" message = tk.Message(main, text=key) message.config(bg='lightblue', font=('Arial', 14, 'italic'), width=300) message.pack(padx=20, pady=20) main.mainloop() This creates a ...

Read More

destroy() method in Tkinter - Python

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 5K+ Views

The destroy() method in Tkinter removes a widget from the screen and frees up memory. It's essential for controlling widget behavior and cleaning up GUI components when they're no longer needed. Syntax widget.destroy() Where widget can be any Tkinter widget including windows, buttons, labels, frames, etc. Example - Button Destruction Chain This example demonstrates how buttons can destroy each other and the main window ? from tkinter import * from tkinter.ttk import * # Create main window base = Tk() base.title("Destroy Method Demo") base.geometry("300x250") # Button that closes the ...

Read More

Create a stopwatch using python

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 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 create a stopwatch by using its tkinter library. This library provides GUI features to create a stopwatch showing the Start, Stop and Reset options. The key component of the program is using the label.after() method of tkinter. Syntax label.after(ms, function=None) Parameters: ms − Time in milliseconds function − Callback function to execute ...

Read More

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

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 297 Views

In this tutorial, we will find all occurrences of the pattern "1(0+)1" in a string using Python's regex module. The re module provides powerful pattern matching capabilities for text processing. The pattern "1(0+)1" represents a literal string containing the number 1, followed by parentheses with "0+" inside, and ending with another 1. Example Input and Output Input: string = "Sample 1(0+)1 string with 1(0+)1 unnecessary patterns 1(0+)1" Output: Total number of pattern matches are 3 ['1(0+)1', '1(0+)1', '1(0+)1'] Algorithm Follow these steps to find the pattern: 1. Import the re ...

Read More

FuzzyWuzzy Python library

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 835 Views

In this tutorial, we are going to learn about the FuzzyWuzzy Python library. FuzzyWuzzy library is developed to compare strings and provides fuzzy string matching capabilities. While we have other modules like regex and difflib to compare strings, FuzzyWuzzy is unique in its approach. The methods from this library return a score out of 100 indicating how closely the strings match, instead of simple true/false or string results. Installation To work with the FuzzyWuzzy library, we need to install fuzzywuzzy and optionally python-Levenshtein for better performance − pip install fuzzywuzzy pip install python-Levenshtein The ...

Read More

Print anagrams together in Python using List and Dictionary

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 765 Views

In this tutorial, we will write a program to find and print anagrams together using list and dictionary. Anagrams are words formed by rearranging the letters of another word, like "listen" and "silent". Algorithm Here's our step-by-step approach ? 1. Initialize a list of strings. 2. Initialize an empty dictionary. 3. Iterate through the list of strings. 3.1. Sort the string and check if it is present in the dictionary as key or not. 3.1.1. If the sorted string is already present dictionary as a ...

Read More

Print first m multiples of n without using any loop in Python

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 794 Views

In this tutorial, we will write a program to find the first m multiples of a number n without using loops. For example, if n = 4 and m = 3, the output should be 4, 8, 12 (three multiples of four). The main constraint is avoiding loops. We can use the range() function to achieve this without loops. The range() function returns a range object that generates a sequence of numbers. Syntax range(start, stop, step) Parameters start − Starting number of the range stop − Ending number (not included in the ...

Read More
Showing 261–270 of 25,467 articles
« Prev 1 25 26 27 28 29 2547 Next »
Advertisements