Python Programming

Python = vs ==

Hello everyone, in this tutorial you’ll see what’s the difference between = and == in python. Most of new programmers get confused with them. Python = vs == = (assignment operator) Well, in simple words, ‘=’ is an assignment operator which is used to assign a value (on right side) to a variable (on left side). Example: …

Python = vs == Read More »

Python Matrix Addition

Here you will get program for python matrix addition. In python “list” concept is there rather than arrays.  For implementing matrix we should take help of lists in python. Matrix can be represented as nested lists. Suppose if we want to implement 2×3 matrix then python syntax will look like this. Matrix=[[1,2,3],[4,5,6]]     #This is 2×3 …

Python Matrix Addition Read More »

Python Read and Write File

In this tutorial, you’ll learn how to read and write file in Python. Program to Write to File f = open(“newtext.txt”,”w”) f.write(“something to be write”) f.close() Output: this program will create a new file (if not exist) named as “newtext.txt” in the same directory where our program is located and write a line “something to …

Python Read and Write File Read More »

Python Merge Sort

Here you will learn about python merge sort algorithm. Merge sort is based on divide and conquer technique. All we have to do is divide our array into 2 parts or sub-arrays and those sub-arrays will be divided into other two equal parts. We will divide the array in this manner until we get single …

Python Merge Sort Read More »

Python Quick Sort

Here you get python quick sort program and algorithm. Quick sort is based on divide and Conquer technique. We divide our array into sub-arrays and that sub-arrays divided into another sub-arrays and so on, until we get smaller arrays. Because it is easy to solve small arrays in compare to a large array. Sorting smaller …

Python Quick Sort Read More »