
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
Found 10476 Articles for Python

3K+ Views
Navigation is the most important part of any application, as it improves the user experience in an aesthetic way. Using Tkinter, we can create menus and submenus very efficiently.Tkinter has an inbuilt function to create menus and these can be invoked with another tkinter widget or window. Tkinter.Menu module provides some properties in Menu-items. Some of these properties are used to label the buttons, toggling the button, adding submenus using cascade properties, etc.In this article, we will see how to create a dropdown menu using tkinter.Menu and its Menu-item properties. We will use OptionMenu widget to create a list of ... Read More

3K+ Views
Tkinter is a popular Python library for creating and developing applications. It has various methods and functions that can be used for adding multiple features in an application.Tkcalendar is one of the tkinter packages that can be used to create GUI-based calendars in the window and thus, we can perform multiple operations like selecting the data, picking and scheduling the event through the calendar application and many more.However, in this article, we will see how we can create a Date Picker calendar using the Tkcalendar package. Before that, we have to install the package in our local environment using pip ... Read More

1K+ Views
Tkinter is a GUI-based Python library which is used to develop various types of functional and GUI-based applications. It provides lots of functions and methods that can be used to provide extensibility and various features while developing an application.In this article, we will see how we can change the mouse cursor while hovering on a button in the tkinter frame using the cursor property. There are plenty of cursor maps available in tkinter’s button library that provide different visuals for the end-user. Some of the cursor in the library are, "arrow""circle""clock""cross""dotbox""exchange""fleur""heart""heart""man""mouse""pirate""plus""shuttle""sizing""spider""spraycan""star""target""tcross""trek""watch"Let us first create some buttons and then we will ... Read More

506 Views
In this article, we will see how to create a GUI-based application that will calculate the average speed. The average speed of a moving object can be calculated using the following formula, Average Speed = Distance / [Hours + (Minutes/60)]To select the input value, we will use the SpinBox method that is used to create a spinner for a range of values. These values are Distance (Kilometers), Hours, and Minutes.Examplefrom tkinter import * #Create an instance of tkinter frame win = Tk() #Set the geometry and resize the frame win.geometry("700x400") win.resizable(0, 0) win.title("Average Speed Calculator") # Create Label ... Read More

664 Views
Write a Python code to find price column value between 30000 to 70000 and print the id and product columns of the last three rows from the products.csv file. Result for price column value between 30000 to 70000 and id and product columns last three rows are − id product 79 80 Truck 81 82 Bike 98 99 TruckSolution 1 Read data from products.csv file and assign to dfdf = pd.read_csv('products.csv ')Apply pandas slicing to access all rows of price column between 30000 to 50000 as, df[df.iloc[:, 4].between(30000, 50000)Save the above result to df1Apply slicing to access last ... Read More

953 Views
Write a Python program to read data from the products.csv file and print the number of rows and columns. Then print the ‘product’ column value matches ‘Car’ for first ten rowsAssume, you have ‘products.csv’ file and the result for number of rows and columns and ‘product’ column value matches ‘Car’ for first ten rows are −Rows: 100 Columns: 8 id product engine avgmileage price height_mm width_mm productionYear 1 2 Car Diesel 21 16500 1530 1735 2020 4 5 Car Gas 18 17450 1530 ... Read More

633 Views
There are two types of operations that can be performed using regex, (a) search and (b) match. In order to use regex efficiently while finding the pattern and matching with the pattern, we can use these two functions.Let us consider that we have a string. regex match() checks the pattern only at the beginning of the string, while regex search() checks the pattern anywhere in the string. The match() function returns the match object if a pattern is found, otherwise none.match() – Finds the pattern only at the beginning of the string and returns the matched object.search() – Checks for ... Read More

3K+ Views
Expression trees are those in which the leaf nodes have the values to be operated, and the internal nodes contain the operator on which the leaf node will be performed.Example: 4 + ((7 + 9) * 2) will have an expression tree like -Approach to solve this ProblemIn order to construct an Expression Tree for a given expression, we generally use Stack Data Structure. Initially we Iterate over the given postfix expression and follow the steps as given below -If we get an operand in the given expression, then push it in the stack. It will become the root of the ... Read More

321 Views
Let us suppose we have three numbers. The task is to count the total number of optimal steps to make all these numbers '0'.For ExampleInput-1:a = 4 b = 4 c = 6Output:7Explanation:The total number of optimal steps to make all the numbers '0' is, (4, 4, 6)Removing '1' from 1st and 2nd number = (3, 3, 6)Removing '1' from 1st and 3rd number = (2, 3, 5)Removing '1' from 1st and 3rd number = (1 ,3, 4)Removing '1' from 1st and 3rd number = (0 ,3 ,3)Removing '1' from 2nd and 3rd number = (0 ,2, 2)Removing '1' from ... Read More

303 Views
Let us suppose we have two strings 'a' and 'b' and a string 'merge'. The task is to fill the string 'merge' with the characters from 'a' and 'b' in such a way that, If the string 'a' is non-empty, then remove the first character from the string 'a' and copy it into string 'merge'.If the string 'b' is non-empty, then remove the first character from the string 'b' and copy it into string 'merge'.If the strings 'a' and 'b' are non-empty, then remove the first characters from string 'a' and copy it into string 'merge' and then remove the ... Read More