Help on Python IDE Selection, find the best IDE as per your requirement.

Find the best Python IDE as per your requirement

Help on Python IDE Selection

Python integrated development environment (IDE) selection for your development work is one of the primary and important work you should do. A good IDE can improve your performance of coding and can also help you to write clear robust code. Here is few choice and ups and downs of those IDEs –

  1. IDLE
  2. eclipse – pydev
  3. anaconda – heavy weight software around 1.5 GB
  4. JetBrains – PyCharm
  5. Sublime

Hope this Video will help you to choose your IDE for python development. Feel free to give comment in comment section of video.

Python hello world program video tutorial.

Video Tutorial on Python hello world program

Video Tutorial of Hello world program in Python

This is Video tutorial uploaded on youtube to understand how to write first python program. This also includes

  1. From where you can download Python setup
  2. How to install it
  3. How to open IDLE script
  4. How to write code in interactive mode of IDLE.

Hope you will like this video and will give your valuable suggestion on this video link.

Insertion Sort in Python

Insertion Sort in Python

Insertion sort is also one of the common sorting technique used. In this technique sorting place after each element encounter. Story of sorting is very simple. Very first node is ignored as it is known as sentinel node. Now from second element will be chosen for sorting. The insertion sort technique checks it position in 0 to n-1 element in the same list where n is the current position and insert the element. This works get repeated till the last element gets sorted. So you will observe that after every elements sorting the list get sorted till the element position. Here is the code and example of Insertion sort.

lst = [15, 6, 13, 22, 3, 52, 2]
print("original list is - ", lst)
for i in range(1, len(lst)):
    key = lst[i]
    j = i - 1
    while j >= 0 and key < lst[j] :
        lst[j + 1] = lst[j]
        j = j - 1        
    else :
        lst[j + 1] = key
    print("List after {0} pass - ".format(i),lst)
print('Now sorted list is - ', lst)

Now we will see the output of the code –

original list is – [15, 6, 13, 22, 3, 52, 2]
List after 1 pass – [6, 15, 13, 22, 3, 52, 2]
List after 2 pass – [6, 13, 15, 22, 3, 52, 2]
List after 3 pass – [6, 13, 15, 22, 3, 52, 2]
List after 4 pass – [3, 6, 13, 15, 22, 52, 2]
List after 5 pass – [3, 6, 13, 15, 22, 52, 2]
List after 6 pass – [2, 3, 6, 13, 15, 22, 52]
Now sorted list is – [2, 3, 6, 13, 15, 22, 52]

Thank you. If you have any query you can ask and post comments to me. I will try to reply.

BUBBLE SORT IN PYTHON

Bubble Sort in Python

Bubble sort is one of the import sorting technique which is implemented in many languages. Here we can implement Bubble Sort technique in Python as well. For this we need an array (Same Data element) which is nothing but a List in Python. The technique is to sort the adjacent element in order (ascending or descending). It you will do so, the largest element in the array will get sorted in every pass. So after every pass one largest element will get sorted in ascending order if sorting is done in ascending order. Here is the sample code for bubble sort and its output after every pass.

'''
Created on Jan 10, 2020<br>
Bubble sort implemented in Python in ascending<br>
order using List.<br>
@author: admin@pythonport.com<br>
'''
lst = [56, 778, 87, 55, 11, 33, 97]
print('Original list is - ', lst)
n = len(lst)
for i in range(n):
     for j in range(0, n - i - 1):
         if lst[j] > lst[j + 1] :
             lst[j], lst[j + 1] = lst[j + 1], lst[j]    
     print('Sorted list after {0} - {1}'.format(i+1,lst))
 print('Sorted list is - ', lst)

Output of above code will look like –

Original list is – [56, 778, 87, 55, 11, 33, 97]
Sorted list after 1 – [56, 87, 55, 11, 33, 97, 778]
Sorted list after 2 – [56, 55, 11, 33, 87, 97, 778]
Sorted list after 3 – [55, 11, 33, 56, 87, 97, 778]
Sorted list after 4 – [11, 33, 55, 56, 87, 97, 778]
Sorted list after 5 – [11, 33, 55, 56, 87, 97, 778]
Sorted list after 6 – [11, 33, 55, 56, 87, 97, 778]
Sorted list after 7 – [11, 33, 55, 56, 87, 97, 778]
Sorted list is – [11, 33, 55, 56, 87, 97, 778]

Thank you . Please post comment you have any query based on Bubble sorting.

Palindrome String check using recursion in Python

Palindrome String check using recursion in Python

Recursion of function is one of the interesting feature of any function of recursive nature. Benefit of using recursion is 1. Less line of code for implementation. 2. No need to write iterative statement multiple time. and easy to learn. In case of recursion the function use to call itself again and again till it reaches at bottom and returns to its caller(self) with calculated value. The self will again calculate next level of value and return to its caller. It goes to continue till it comes out from the very fist call of function. Here We have implemented Palindrome String check using Recursion function.

'''
Created on Jan 8, 2020
@author: admin@pythonport.com
'''
word = input("Enter word to check palindrom string - ")
def palindromCheck(word):
    length = len(word)
    if length == 0 or length == 1:
        return "Palindrom String"
    elif word[0] == word[length - 1] :        
        return palindromCheck(word[1:length - 1])        
    else :
        return "Not Palindrom String"

status = palindromCheck(word)    
print("{0} is {1}".format(word, status))

Here function palindromCheck() is a recursive function which is called from main once by passing the word to check palindrome. Now this function is called again and again by passing current words first position and last-1 position data. If every thing goes well it will return palindrome string else it will return not a palindrome string. Check your self for the output. Hope it helps.

Please comment if you want your valuable feedback or code improvement advice to be added by me.