
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 33676 Articles for Programming

3K+ Views
It is a general requirement to have a reasonably complex password. In this article we will see how to validate if a given password meats certain level of complexity. For that will use the regular expression module known as re.Example -1First we create a regular expression which can satisfy the conditions required to call it a valid password. Then we e match the given password with the required condition using the search function of re. In the below example the complexity requirement is we need at least one capital letter, one number and one special character. We also need the ... Read More

9K+ Views
Lists are a very widely use data structure in python. They contain a list of elements separated by comma. But sometimes lists can also contain lists within them. These are called nested lists or multidimensional lists. In this article we will see how to create and access elements in a multidimensional list.Creating Multi-dimensional listIn the below program we create a multidimensional list of 4 columns and 3 rows using nested for loops.Example Live Demomultlist = [[0 for columns in range(4)] for rows in range(3)] print(multlist)OutputRunning the above code gives us the following result −[[0, 0, 0, 0], [0, 0, 0, 0], ... Read More

691 Views
MongoDB is a widely used document database which is also a form of NoSQL DB. Python can interact with MongoDB through some python modules and create and manipulate data inside Mongo DB. In this article we will learn to do that. But MongoDB should already be available in your system before python can connect to it and run. To setup MongoDB in your system please visit our MongoDB tutorial here..Install pymongoTo interact with MongoDB we need the module names pymongo. Install it in your python environment using the below command.pip install pymogoCheck the Existing DBsWe now use this python module ... Read More

386 Views
If a Python program can be broken into subprograms who is processing do not depend on each other, then each of the subprogram can be run in parallel when the overall program is being run. This concept is known as parallel processing in Python.With multiprocessingThis module can be used to create many child processes of a main process which can run in parallel. In the below program we initialize a process and then use the run method to run the multiple sub-processes. We can see different sub processes in the print statement by using the process id. We also use ... Read More

437 Views
The stat() method is part of OS module which describes various OS related operations on files and directories. For example, if we want to know various user defined flags for a file or size of the file in bytes.Functions in os.stat() moduleBelow is a list of some sample functions available in stat() and their meaning.st_size − It represents the size of the file in bytes.st_atime − It represents the time of most recent access. It is expressed in seconds.st_ctime − It represents the time of most recent metadata change on Unix and creation time on Windows. It is expressed in seconds.st_blocks ... Read More

17K+ Views
When running python programs, we need to use datasets for data analysis. Python has various modules which help us in importing the external data in various file formats to a python program. In this example we will see how to import data of various formats to a python program.Import csv fileThe csv module enables us to read each of the row in the file using a comma as a delimiter. We first open the file in read only mode and then assign the delimiter. Finally use a for loop to read each row from the csv file.Exampleimport csv with ... Read More

3K+ Views
Python can be used to access webpages as well as post content to the webpages. There are various modules like httplib, urllib, httplib2 etc but the requests module is simplest and can be used to write simpler yet powerful programs involving GET and POST methods.GET methodThe GET method is part of the python requests module which is used to obtain data from a web URL. In the below example we reach out to our own website and find out various responses through the get method. We get the encoding, response time and also the header and part of the body.Example Live ... Read More

2K+ Views
Python can also be used to create computer games. In this article we will see how the ball catching game can be created using python. In this game a ball keeps falling from the top of a canvas window and a bar is present at the bottom of the window. Two buttons are provided to move the bar in the left and right direction. Using mouse button presss we move the bar at the bottom to catch the falling ball. At different times the ball falls from different positions .ApproachThe approach to build the game is described in the following ... Read More

1K+ Views
Difference Between Adjacent List Elements The given task is to calculate the difference between the adjacent elements in the given list using Python, i.e, we need to subtract the current element from the next element and repeat this for each element in the list (except the last one). Scenario Following is an example scenario: Input: [10, 15, 12, 18] Output: [5, -3, 6] Explanation: Difference between 15 and 10: 15 - 10 = 5 Difference between 12 and 15: 12 - 15 = -3 Difference between 18 and 12: 18 - 12 = 6 Using List ... Read More

2K+ Views
In python tkinter is a GUI library that can be used for various GUI programming. Such applications are useful to build desktop applications. In this article we will see one aspect of the GUI programming called Binding functions. This is about binding events to functions and methods so that when the event occurs that specific function is executed.Binding keyboard eventIn the below example we bind the press of any key from the keyboard with a function that gets executed. Once the Tkinter GUI window is open, we can press any key in the keyboard and we get a message that ... Read More