
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

602 Views
Kivy is an open source Python library for rapid development of applications that make use of innovative user interfaces, such as multi-touch apps. It is used to develop the Android application, as well as Desktops applications. In this article we will see how to use events when a button is pressed.In the below example we have created a button and a label in a horizontal BoxLayout. We give initial text to the button and label. Then we create an event for clicking the button which changes the text both in the button and in the label. It is a single ... Read More

723 Views
Kivy is an open source Python library for rapid development of applications that make use of innovative user interfaces, such as multi-touch apps. It is used to develop the Android application, as well as Desktops applications. In this article we will see how to use the BoxLayout widget to create buttons of different orientation and colours.In the below code we first create an outer box whose orientation is vertical. Then we create a row 1 with horizontal orientation. Then two other rows again with vertical orientation. We wrap all these rows in the outer box and giver different text and ... Read More

654 Views
Kivy is an open source Python library for rapid development of applications that make use of innovative user interfaces, such as multi-touch apps. It is used to develop the Android application, as well as Desktops applications. In this article we will see how to use the anchor layout positioning.Using AnchorLayouts we place the widgets at one of the borders. The class kivy.uix.anchorlayout.AnchorLayout implements the anchor layout. Both the anchor_x parameter and anchor_y parameter can be passed the values ‘left’, ‘right’ and ‘center’. In the below program we create two buttons, attach them to two anchors and keep them in a ... Read More

5K+ Views
Many times python will receive data from various sources which can be in different formats like csv, JSON etc which can be converted to python list or dictionaries etc. But to apply the calculations or analysis using packages like pandas, we need to convert this data into a dataframes. In this article we will see how we can convert a given python list whose elements are a nested dictionary, into a pandas Datframe.We first take the list of nested dictionary and extract the rows of data from it. Then we create another for loop to append the rows into the ... Read More

1K+ Views
Suppose we have two strings s and t. We have to find the smallest substring in s, where t is also a subsequence of the substring. If that type of substring does not exist, we will return a blank string, and if there are multiple smallest substrings, we will take the leftmost one.So, if the input is like s = "abcbfbghfb", t = "fg", then the output will be fbgTo solve this, we will follow these steps −N := size of Sdp := a new list of size N initialized with infinityfor i in range 0 to N − 1, ... Read More

520 Views
Suppose, we have a lowercase string s that contains letters and parentheses "(" and ")". We have to reverse every string enclosed within parentheses in a recursive manner and return the resultant string.So, if the input is like s = "back(aps)ce", then the output will be “backspace”.To solve this, we will follow these steps −Define a function trav() . This will take s, dir, start, close:= close, ans:= ansend := "(" if dir is same as −1, otherwise ")"other := "(" if end is same as ")", otherwise ")"while start < size of s, and s[start] is not same as ... Read More

228 Views
Suppose, we have a car and are driving it on a one−dimensional road. Currently we are at position = 0 and with speed = 1. We can perform any of these two operations.Acceleration: position := position + speed and speed := speed * 2 Reverse Gear: speed := −1 when speed > 0 otherwise speed := 1.We have to find the number of moves needed at least to reach the target.So, if the input is like target = 10, then the output will be 7.To solve this, we will follow these steps −Define a function dfs() . This will take ... Read More

130 Views
Suppose we are playing a unique game and we have three values n, k, and h. We start from 0 points, then we can select a number randomly between 1 and h (inclusive) and we will get that many points. We stop when we have scored a minimum of k points. We have to find the probability that we have n or fewer points. Here any number can be chosen randomly and the outcomes all have the same probability.So, if the input is like n = 2, k = 2, h = 10, then the output will be 0.11.To solve ... Read More

172 Views
Suppose we have a list of numbers. We have to find the length of the longest sequence of numbers such that when we delete a number from the sequence, each number occurs the same number of times.So, if the input is like numbers = [2, 4, 4, 7, 7, 6, 6], then the output will be 7.To solve this, we will follow these steps −num_freq := a new mapfreq_freq := a new mapdiff_freq := a new setresult := 1for each index I and value num in nums, docur_freq := num_freq[num]num_freq[num] := num_freq[num] + 1freq_freq[cur_freq] := freq_freq[cur_freq] − 1freq_freq[cur_freq + 1] ... Read More

216 Views
Suppose, we are provided with a list of numbers called nums. Here we can jump to index i + numbers[i] or to i − numbers[i] from index i if the values exist in the list. So we have to find the number of jumps required at least to reach another value with different parity keeping the order in the input unchanged. If we cannot reach another number with different parity, it is set to −1.So, if the input is like numbers = [7, 3, 4, 5, 6, 9, 6, 7], then the output will be [−1, 1, 2, −1, −1, ... Read More