Python Define Functions

python define function

What are Python Functions?

In the python programming context, function is a named collection of python statements combined together to perform specific task. Python def keyword is used to define the function in python. It is a package of generic python code which you can be used whenever required in your code.

There are many built in functions available in the python. Also, there are possibility to create new customised, user written functions in python using python def keyword.

Built-in Function

Python built-in functions are already predefined into python standard library hence you don’t need to import any modules to use built-in functions.

You have already seen many python functions since my first article –What is python? Starting from basic program to print “Hello World” to more complicated and lengthy codes. You might have written “print” statement thousands of time, but did you ever wonder how print – statement works?

Similarly, there are other functions we use regularly such as – input, eval, int, float, range, and type. These are the common built-in functions included in the python standard library hence can be available at any time. 

Apart from this we do have many other built in functions in python but to use those functions you need to import related modules in the beginning of your code.

Use defined function

The function we define /creates by ourselves to perform any specific task known as user defined function. Python def keyword is used to define user defined functions.

The whole concept of functions revolves around two things – first, how you define / write your function and second, how and where you call that function by supplying necessary parameters to the function.

Syntax:

 
#define your python function (python def Keyword)
def FunctionName(parameters) 
	. . . . . . . . . 
	. . . . . . . . .
#call python function
def FunctionName(parameters)

Try to understand simple python function – show() to display some predefined text message whenever this function gets called in the code.

 
#define show() function
def show():
    print("Show function executed")
#call show() function
show()



Python_Functions.py


Show function executed
>>>

Output

Observe this example – show() is your user defined/created function but inside show() function we are calling built-in print() function. 

Now we know when we call show function, it will execute lines of code written inside the function. In a similar way, when we are calling print() function – some sort of python code executes which is available in the python standard library. 

There are many generic codes already written in python and imported into python standard library. In function irrespective of its types- either built-in or user defined, there are some rules needs to be followed as per logic written inside that function in ordered to reuse the code.

Example:

Python Function to add two numbers

This example demonstrates simple python function to add two numbers by taking inputs from user.

 
#definefun function - add()
def add(a,b):
    result=a+b
    print("Addition of two numbers :", result)
#take input from user
a=int(input("Enter First Number :"))
b=int(input("Enter Second Number :"))    
#call add() function to perform addition.
add(a,b)

Python_add.py


Show function executed
Enter First Number :25
Enter Second Number :100
Addition of two numbers : 125
>>> 

Output

Python try except and finally

Python try except and finally - exceptional handling

An exception is a very known to every programmer! Afterall we most of the time seems to be playing with this keyword. Python try except and finally statements allow you to handle these exceptions.

Python exception or error doesn’t indicate that there is always something wrong with the logic or algorithm. 

There are some circumstances where your program is absolutely correct, still you encounter run-time error that situation is known as an EXCEPTION.

At this point, our run time errors resulted in a termination of program execution. Rather terminating the program execution, program could detect the error before hand and handle it in a very smart way, that concept is called as Exceptional handling.

An Exceptional handling is a standard python mechanism allows programmers to deal with the run-time errors. 

Examples of exceptional errors: integer division by zero, attempting to convert a non-number to an integer, accessing a list with an out-of-range index, and using an object reference set to None.

Few common python exceptions are described here but if you want to go through all the exception list then visit this page Python built-in Exception.

PYTHON EXCEPTIONS

1. ZeroDivisionError: division by zero

You have a program where you are doing some calculations. You have defined two integer variables and assigned value to them. Now you are trying to attempt division operation.

N1=int(input(“Enter first Number – N1 :”))

N2=int(input(“Enter Second Number – N2 :”))

Result=N1/N2

print(“Result :”, Result)

Your code is absolutely perfect, and it will give you division answer but what will happen if user enters 0 value for variable N2! Always remember, you never have a control over an end user. 

In this case program execution will be terminated with error – ZeroDivisionError: division by zero

Output

Enter first Number – N1 :100

Enter Second Number – N2 :0

Traceback (most recent call last):

File “C:/Users/Python37/exceptional_handling.py”, line 3, in

Result=N1/N2

ZeroDivisionError: division by zero

>>>

2. ValueError: invalid
literal for int()

To continues with same above example where you expect user should enter integer number(digits) but consider user has entered some random characters or numbers in a word (say five instead of 5) for variable N1 then WHAT? It will throw this exception – ValueError: invalid literal for int()

Enter first Number – N1 :five

Traceback (most recent call last):

  File “C:/Users/Python37/exceptional_handling.py”, line 1, in <module>

    N1=int(input(“Enter first Number – N1 :”))

ValueError: invalid literal for int() with base 10: ‘five’

>>> 

3. OverflowError:
integer division result too large for a float

To continues with the same example, now user has entered very large number for variable N1. Observe what happened with your result – error  OverflowError: integer division result too large for a float

python exception handling OverflowError

Looking for Solution?

Yes, it is absolutely possible to write a code to avoid such kind of errors in python like other programming languages, but python has unique features which you can apply.

Python has built in conditional execution structure to handle the situation where you might encounter expected or unexpected run-time errors.

1.    Try

2.    Except

3.    Else

4.    Finally

Python Try and except

try/except block to be added where you think potential exception can occur in your program. 

Syntax:

try:

                  #It contains code that might raise an exception.

except:

                  #It contains code to execute Only when try block raise an exception.

Back to our previous example and we will see how it works. Now you know where possible exception error can come in our example so try to add try/except block into it.

Firstly, we will try display text message to the user so they can understand what went wrong! The technical error user might not understand so let’s change default error message with simple plain English text.

try:

    N1=int(input(“Enter first Number – N1 :”))

    N2=int(input(“Enter Second Number – N2 :”))

    Result=N1/N2

    print(“Result :”, Result)

except ValueError:

    print(“Oops!! Seems you have entered invalid Number”)

except OverflowError:

    print(“Oops-ERROR!! Result value seems to be too large to display”)

print(“Program execution continues….”)

Scenario #1

Enter first Number – N1 :five

Oops!! Seems you have entered invalid Number

Program execution continues….

>>> 

Scenario #2

python try except exception handling

Summary

  • Program execution doesn’t terminate when you use try except block and exception occurs.
  • An except block doesn’t execute unless try block don’t raise an exception.
  • Multiple except block can be written for one try block.

Python else

If try block raise an exception, then only except block gets executed otherwise else block will be executed.

In other words, else block only executed when try block do not raise an exception.

try:

    N1=int(input(“Enter first Number – N1 :”))

    N2=int(input(“Enter Second Number – N2 :”))

    Result=N1/N2

    print(“Result :”, Result)

except ValueError:

    print(“Oops!! Seems you have entered invalid Number”)

else:

print(“Division Successful!”)

print(“Program execution continues….”)

Python finally

finally block always executes after try/except block execution. It does nothing extraordinary, just creates the space for you to execute something after try/except block.

try:

    N1=int(input(“Enter first Number – N1 :”))

    N2=int(input(“Enter Second Number – N2 :”))

    Result=N1/N2

    print(“Result :”, Result)

except ValueError:

    print(“Oops!! Seems you have entered invalid Number”)

finally:

print(“Executing finally…block!”)

print(“Program execution continues….”)

So far, we have seen basic use of try/except, else and finally block in python. Mostly it is being used with the conditional loop statements and allow users to try one more time – with proper message on screen when they enter wrong values, for instance.

Example

Write a program to demonstrate an
exceptional handling case with Loop statements!

In this example users can input any small integer value less than 100. They can enter number greater than 100 to complete the program execution. This code will not fail or terminate the execution if try block raise ValueError exception.

x = 0

while x < 100:

    try:

    # I hope the user enters a valid Python integer!

        x = int(input(“Please enter small integer Number: “))

        print(“x =”, x)

    except ValueError:

        print(“Oops!! Input cannot be parsed as an integer – Please try again”)

print(“Program finished”)

 

Output

Please enter small integer Number: 25

x = 25

Please enter small integer Number: 50

x = 50

Please enter small integer Number: five

Oops!! Input cannot be parsed as an integer – Please try again

Please enter small integer Number: 5

x = 5

Please enter small integer Number: 200

x = 200

Program finished

>>> 

 

Read More: Python raise Keyword

Python raise keyword

python raise keyword

Python raise keyword. In python we can raise exception by using raise keyword. We have already gone through detailed overview on in-built Python exceptions and how it is being handled with python try except & finally statements.

All these exceptions are default and python interpreter decide when to raise the exception but WHAT if you want to raise an exception?

Python raise

Python gives your flexibility to raise exception whenever you want in the program. It is very powerful keyword and having unique features in it.

Mostly people are using python raise – keyword in conditional block to decide when and where to raise an exception.

Syntax:

raise  <exception>

When you specify raise keyword in your code and the moment program execution reaches that point – immediately exception is being raised by skipping further statements. 

An interpreter doesn’t see, whether do you really have an error in your code or not. It simply raises an exception as per specified exception name.

Example

Python_raise.py

var=10

print(“Var= “, var)

raise ValueError 

print(“Program execution continues….”)

Output:

Var=  10

Traceback (most recent call last):

  File “C:/Users/Documents/Python_raise.py”, line 3, in <module>

    raise ValueError

ValueError

>>> 

Python raise keyword most often used in try block for various reasons for instance, to cross verify whether exceptions are properly getting raised and check its execution flow, to avoid the program execution termination, etc.

python_raise.py

try:

    var=10

    print(“Var= “, var)

    raise ValueError

except ValueError:

    print(“Oops!! Value error raised “)  

print(“Program execution continues….”)

 

Output

Var=  10

Oops!! Value error raised

Program execution continues….

Use raise keyword in try except

It is very effective way to check whether your exceptional handling code – try/except block working properly without involving end user. 

If there would be chances of an exception can occur in your code where you already applied, try/except blocks but you want to test it then you can add raise keyword there.

Observe this example – We are performing division of two numbers by taking inputs from users.

In this case we know ValueError exception can occur if user enter non-digit number. We have already seen this example here.

Now we could test this exception by raising ValueError exception manually in the code, irrespective of user inputs. 

Python_raise.py

try:

    N1=int(input(“Enter first Number – N1 :”))

    N2=int(input(“Enter Second Number – N2 :”))

    Result=N1/N2

    print(“Result :”, Result)

    raise ValueError

except ValueError:

    print(“Oops!! Seems you have entered invalid Number”)

print(“Program execution continues….”)

Note this result – we have entered correct input values still ValueError exception encountered due to raise keyword specified in try block code.

Output

Enter first Number – N1 :100

Enter Second Number – N2 :12

Result : 8.333333333333334

Oops!! Seems you have entered invalid Number

Program execution continues….

>>> 

 

Read More: Python try except and finally

Python Exception and Errors

Python Exception and error

python error & built-in exceptions

There are many built-in python exception an interpreter raises whenever the extraordinary situation encounters in the program. 

People often gets confused with error and exception as both looks very similar but these two operates in a very different way.

Python Error

Error encounters in the program when something wrong with the code. In error situation, program execution gets terminated and there is no way to handle this case unless you don’t fix the error.

Most common error observed with programmer is – syntax error. Observe this example to understand how error looks like in python.

This example demonstrates syntax error with if statement. You can see, semicolon is missing in if statement.

var=100

if var>10

    print (“Variable – var=”, var)

  File “C:/Users/Documents/Python_raise.py”, line 2

    if var>10

            ^

SyntaxError: invalid syntax

Python built-in Exceptions

The built-in exceptions are raised by interpreter or built-in functions whenever an extraordinary error situation occur in the code. 

When an exception encounter in your code, program execution will get terminated unless you don’t handle specific situation in your code. HOW to handle an exception? Visit this page – Python try/except and finally Statements.

There is also possibility to raise built-in exception manually by using raise keyword. Visit this page to learn more about Python raise keyword.

[table id=1 /]

Read More : Python try except and finally statements.

Python Loop Control/Jumping Statements- break, continue & pass

python loop control or jumping statements break continue and pass

Apart from common control statements – IF-ELSE, WHILE-loop, FOR-loop, etc we do have something in python called as Loop Control or jumping statements. 

There are three such statements used for special purposes which is standard control statements can’t perform effectively.

     1. BREAK

     2. CONTINUE

     3. PASS

Each statement has its own features and will be very useful to control your program execution. It gives you flexibility to re-route program execution to achieve the desired result or build a more generic and powerful solution. 

Follow each statement carefully to understand its features. 

1. break

Sometimes you are in a situation where you want to skip a part of loop  (in WHILE or FOR – loop) from execution and continue with the next iteration. You can use break or continue statements to handle such situations.

 

You are now already known to FOR loop- range control statement hence we will take the same example to demonstrate break statement.

Read more about for-loop

Example 1: We will try to break the for-loop as soon as your program reach to count 5 in a range value of 0 to 10 and print the values to understand execution better.

Example 2: We will try to break the for-loop as soon as your program reach found the character “t” in a string(word) – “P-y-t-h-o-n” and print the characters to understand execution flow better.

#Example 1

for i in range(0, 10):

    if i==5:

        break

    print(“Range Value :”, i)

 

#Example 2

for var in ‘Python’:

    if var == ‘t’:

        break

    print (“Current Letter :”, var)

 

Output:

Range Value : 0

Range Value : 1

Range Value : 2

Range Value : 3

Range Value : 4

Current Letter : P

Current Letter : y


 

2. continue

The continue statement in python allows you to skip further statements for that specific iteration and send control back to top, beginning of loop. 

It can be used in the WHILE or FOR loops.

Let’s modify above examples by just replacing break keyword with continue keyword and see the result.

#Example 1

for i in range(0, 10):

    if i==5:

        continue

     print(“Range Value :”, i)

 

#Example 2

for var in ‘Python’:

    if var == ‘t’:

        continue

    print (“Current Letter :”, var)

      The output of example 1 with continue keyword – It will print all the range values (0 to 10) except 5.

      The output of example 2 with continue keyword – It will print all the characters (P-y-t-h-o-n) except “t”

Range Value : 0

Range Value : 1

Range Value : 2

Range Value : 3

Range Value : 4

Range Value : 6

Range Value : 7

Range Value : 8

Range Value : 9

Current Letter : P

Current Letter : y

Current Letter : h

Current Letter : o

Current Letter : n

3. pass

The pass command in python used where you don’t want to execute any piece of code in the loop. It allows you to skip the block of code from execution. 

It is mostly used in the development phase of your program as you may specify pass statement where you feel possibilities that code execution can go in the flow and you want to nullify the block. 

Of course, you can track all your pass statements by adding print statement under pass block with appropriate comment.

Let’s discuss same examples – 

Example 1: If you want to pass the block of code when counter or range value reach at 5 and everything else should print as-is.

Example 2: If you want to pass the block of code when character “t” found in the string (word) “P-y-t-h-o-n” and everything else should be printed as-is.

#Example 1

for i in range(0, 10):

    if i==5:

        pass

        print(“pass block for range value(5)”)

    print(“Range Value :”, i)

print(“Good bye- Example 1”)

 

#Example 2

for var in ‘Python’:

    if var == ‘t’:

        pass

        print(“pass block for range value(t)”)

    print (“Current Letter :”, var)

print(“Good bye- Example 2”)

Output:

Range Value : 0

Range Value : 1

Range Value : 2

Range Value : 3

Range Value : 4

pass block for range value(5)

Range Value : 5

Range Value : 6

Range Value : 7

Range Value : 8

Range Value : 9

Good bye- Example 1

Current Letter : P

Current Letter : y

pass block for range value(t)

Current Letter : t

Current Letter : h

Current Letter : o

Current Letter : n

Good bye- Example 2

Read More: Python IF-ELSE   For-Loop  While-Loop

Python WHILE Loop & FOR Loop Control Flow Statements

Python while loop and for loop control flow statements

In this article we are going through Loop control flow statements in python. It is almost same as other programming language such as C, C++ or java etc.

Sometimes you must take control on program execution to run same set of code in a loop to get the desired output. To control the program execution, we have special utilities or statements called as “Control flow statements” 

The loop statements while or for allow us to execute a statement(s) over and over. A loop is controlled by a boolean expression that determines how many time statements can be executed.

Python has two primitive loop commands:
           1. While – loop
           2. For – loop

1. WHILE Loop

While condition is true keep running the loop and exit as soon as the condition becomes false. The conditional while loop syntax is the same as for if-else and elif statements.

Syntax:

while (conditional test):

    <statement1>

    <statement2>

    . . . .

    <last statement>

Example:

Python while loop statement code
Output:

Python while loop statement output

2. For Loop

Another loop statement – for, is best for when you determine in advance how many times you need to execute the block of statements placed in the loop.

It allows you to perform an operation on each element in a list or character in a string.

Syntax:

for in :

   

   

   


There are two types of for loops in python, first one is List – for loop and second one is          Range – for loop.

2.1 List – for loop

It’s very simplest method, all you need to do to specify complete list of items and it will be available in the loop.

Example:

python for loop statement code

Output:

python for loop statement output

Let’s take one more example-

for integer in [0, 1, 2]:

    print (“Integer :” + str(integer))

    print (“Integer Multplication :”+ str(integer * integer))

Output:

Integer :0

Integer Multplication :0

Integer :1

Integer Multplication :1

Integer :2

Integer Multplication :4

2.2 Range – for loop

For loop with range, gives you flexibility to use the appropriate range of values and important thing is you can control that range using available options along with for.

Syntax:

for var in range (start_pos, end_pos, steps):

    statement(s)

  • start_pos: Start position value should be excluded from range value when you specify value for steps otherwise it can be counted.
  • end_pos: End position must be excluded from range value.
  • steps: Steps value controls the range values.

Example:

python for loop range code
python for loop range output

Few more examples which will clear all your doubts if you have any!

Ex. 1

for i in range (1, 20, 2):

    print (“Range value :” + str(i))

Output:

Range value :1

Range value :3

Range value :5

Range value :7

Range value :9

Range value :11

Range value :13

Range value :15

Range value :17

Range value :19

Ex. 2

for i in range (20, 0, -2):

    print (“Range value :” + str(i))

Output:

Range value :20

Range value :18

Range value :16

Range value :14

Range value :12

Range value :10

Range value :8

Range value :6

Range value :4

Range value :2

 

Read More: Python break, continue and pass statements

Python IF ELSE & Nested IF-ELSE Control Flow Statements

Python IF ELSE and Nested IF ELSE control flow statements

In this article we are going through Python IF ELSE control flow statements. It is almost same as other programming language such as C, C++ or java etc.

The program default executes sequentially but sometimes you have to take control on program execution to get the desired output. To control the program execution, we have special utilities or statements called as “Control flow statements” 

Control
Flow IF-ELSE Statements:

               1. IF-ELSE

               2. Nested IF-ELSE

1. Python IF ELSE

IF-ELSE statement used to evaluate the condition and executes the block of statements based on results which is either YES (true) or NO (false)

General Syntax:

If (Condition)

Statement(s)

Else

Statement(s)

Syntax in Python: 

It is bit different syntax in python to write IF-ELSE conditional control flow statements. A blank spaces (indentation) is very important factor while writing code in python, especially if-else or nested if-else multiple conditional blocks. One extra blank space can kill your program!

if:

            <statement(s)>

else:

            <statement(s)>

Note: Please make a note, if-else statements are in lower case characters. In case if you write it in upper case, then you will get syntax error which is most common mistake people are doing. Python is very case sensitive language! 

Example:

Python IF ELSE Statement code

Output:

Python IF ELSE Statement code output

2. Nested IF ELSE

Simple IF-ELSE works fine but if you have multiple conditions and each one of them depends on another condition then Nested If-ELSE is very useful and effective.

It gives you flexibility to write multiple conditions and control your set of commands. It also helps to minimize the execution time as if one condition is true then it will skip further conditions and saves the time.

Syntax:

if :

            <statement(s)>

elif :

            <statement(s)>

elif :

            <statement(s)>

else:

            <statement(s)>

Be careful with if-elif-else statements, they must appear as-is in lower case and ELSE IF should be elif only. In case if you write any character in uppercase or elseif instead of elif, then you will defintely gets syntax error. Python is very case sensitive language and doesn’t allow any syntax violation.

Example:

Python Nested IF ELSE Statement code
Python Nested IF ELSE Statement output

Read More: Python For Loop and While Loop

What is Program, Algorithm and Flowchart

what is Program ?

A program is a collection of instructions that performs a specific task when executed by a computer.An algorithm and flowchart are the basic components of programming.

Programs can be written either in one of high level language which executes slowly, or low level language (machine or assembly language) which executes very faster.

main()

{

printf(“hello world!!n”);

}

Python Compiler

It converts instructions into machine language. We write a code is in the format of human readable or in a plane English text of course by following some specific set of rules associated with that programming language. Computer need something to translate those text into machine readable format. 

Compiler translate your program that is source code (high level programming language) into machine code (or assembly language or low level language) to create an executable program.

Source code ——–à>>Compiler
——–à>> machine code

Program Compiler Design

Keywords

A keyword is a reserved identifier used by the language to describe a special feature. It is used to declare an object, or in a function body to describe the statement executed. It can not be used as a constant or variable or any other identifier name. 

For instance, if you use any reserved keywords in python like pass or class then check here what complications could introduce in your simple program.

Algorithm

An algorithm is a step by step guide written to solve the problem in a very simple way or in a plane English language. It is a roadmap of your thoughts – where to start, what to start, how should proceed and wrapping up your program.  It represents process or flow of your program in a simple words.

The main motto of designing of an algorithm to have clear understanding on requirement and its solution. Anyone from outside who doesn’t familiar with programming language can understand overall picture of your so complicated program logic in a very generic way. An algorithm is used to create the flow chart.

Examples

Let’s take an example: Write an algorithm to add two numbers!

               1. Start

               2. Take two numbers (x and y)

               3. Apply formula to perform your task: (ans=x+y)

             In this example; we can add two numbers (x and y) and store result in                     variable “ans”.

               4. Display result

               5. End

Here is one more – Write an algorithm to check whether seller has profit or loss.

               1. Start

               2. Collect the product data from seller- Its selling price and actual cost.

               3. Apply formula to calculate profit

              (Profit = selling price – product cost)

               4. Take a decision –

               – if profit is greater than zero; that means seller got some profit in                             business

               – if profit is less than zero; that means seller got some loss in business

               – if profit is equal to zero; that means seller neither got profit nor loss.

               5. Display result

               6. End

Everyone has our own views to look at the problem and of course has the different ways to solve it. Here is one of the alternatives to check profit or loss.

            3.   Apply formula to calculate profit

                  (Profit = selling price – product cost)

               4. Take a decision –

               – if selling price is greater than product cost; that means seller got some                     profit in business

               – if selling price is less than product cost; that means seller got some loss                   in business

               – if selling price is equal to product cost; that means seller neither got                       profit nor loss

Likewise, you can write algorithm of your program in a very simple way. 

Try this one on your own in comment section below – Write an algorithm to calculate average of five numbers? Or maybe this one – To check whether entered numbers are even or odd?

Flow Chart

The flow chart is a graphical or symbolic representation of your algorithm, process or workflow.

This diagram representation demonstrates a solution model of a given program. Flow charts are being effectively used in analyzing, designing and managing processes in the big projects. It is essential part of the program especially when you are dealing with the complex requirement. 

Flow chart has its common alternative names include: flowchart, process flowchart, functional flowchart, process map, process chart, functional process chart, business process model, process model, process flow diagram, workflow diagram, etc.

Symbolic representation

Overview of common symbolic representation of flow chart:

Program flow chart symbols

Let’s try to build flow chart of our second example algorithm – to check whether seller has profit or loss.

Program Flow chart

What are your thoughts on “What is program, algorithm and flow chart” ?

Python – Home

Python is easy to use, powerful, and versatile, making it a great choice for beginners. The readability of python code makes it great first programming language. It allows you to more concentrate on your logic instead of mysterious syntax like any other language as syntax is very simple and user friendly.

Python is a multi-paradigm, Object-oriented and structured programming language. It is an interpreted high-level programming language for general-purpose programming. Created by Guido van Rossum and first released in 1991, Python has a design philosophy that emphasizes code readability, notably using significant whitespace known as interpreter.

On the origins of Python, Van Rossum wrote in 1996:

…In December 1989, I was looking for a “hobby” programming project that would keep me occupied during the week around Christmas. My office … would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python’s Flying Circus).

— Guido van Rossum

New To Python?

If you haven’t programmed before or simply interested in learning another language, we have the resources to help you GET STARTED... Take a look at our comprehensive guide that introduces you to the basics of the language, and then takes you all the way through solving complex problems using python programming.

Prerequisite for Python

It would be very helpful to get started with python if you know the basic concepts of programming like variables, datatypes, functions, loops etc but it is not mandatory. If you are really interested in programming and want to start somewhere then you are on right place – Python would be great choice considering future technologies – Artificial Programming, Machine learning, Deep learning etc.