Why How & from Where do I learn Python?

In our last post we went about analysing needs and uses of node js. In this post we are going to talk about why, how and from where you should learn python.

image

Why Learn Python?

To answer this question, lets first try writing a simple program in few different languages and see the difference for ourselves. For our purpose lets start with a program to generate fibonacci series.

Fibonacci in C

#include<stdio.h>

int main()
{
   int n, first = 0, second = 1, next, c;

   printf("Enter the number of terms\n");
   scanf("%d",&n);

   printf("First %d terms of Fibonacci series are :-\n",n);

   for ( c = 0 ; c < n ; c++ )
   {
      if ( c <= 1 )
     next = c;
      else
      {
     next = first + second;
     first = second;
     second = next;
      }
      printf("%d\n",next);
   }

   return 0;
}

Fibonacci in JAVA

class FibonacciExample1{
public static void main(String args[])
{
  int n1=0,n2=1,n3,i,count=10;
  System.out.print(n1+" "+n2);//printing 0 and 1

  for(i=2;i<count;++i)
  {
   n3=n1+n2;
   System.out.print(" "+n3);
   n1=n2;
   n2=n3;
  }
 }}

Fibonacci in Clojure

(defn fib
  ([n]
     (fib [0 1] n))
  ([x, n]
     (if (< (count x) n)
       (fib (conj x (+ (last x) (nth x (- (count x) 2)))) n)
       x)))
Fibonacci in Python

def fib(n):
    a,b = 1,1
    for i in range(n-1):
    a,b = b,a+b
    return a

print fib(5)

Though, its not possible for us to compare different languages by implementing a simple fibonacci generator, over here we are trying to identify the uniqueness of implementing a simple function in python.

If we analyse the above implementations of generating a fibonacci series ourself we know for sure, that python is easy to read and write. Following are the major advantage that python has :

1. Easy Syntax

Python syntax uses keywords very similar to English words commonly used while speaking. If you are comign from DB Admin background you know, what we are talking about. Python has a syntax somewhat similar to SQL except that we use it for programming. Think the ease of usage and readability.

2. Level of Control/Programming:

Python excels at prototyping. A permissive syntax helps with productivity as well. You could do all kinds of task with python - Web development,Application,Scripting, Game Programming and much more. Features like Built-in memory management, standard data types(Numbers, String, List, Tuple, and Dictionary), Polymorphic typing, Method definitions with arguments and return statements, Backus–Naur Form grammar make it easy for newbies to get started and tinker with things.

3. It's Object Oriented and supports functional programming too.

Python has been an object-oriented language since it existed. Because of this, creating and using classes and objects are downright easy. Here is a link to getting functional in python.

4. It has a whole set of libraries which you could use.

Python has got tonnes of libraries foralmost everything that you want to do with your computer or the web. Take a look at these useful python modules.

5. Supportive Open Source Community

Python recently moved to github. It has a strong online community. Discussion forum, Mailing List, and Sub Reddits. There are tonnes of meetups and conferences on python, where you get an opportunity to meet and interact awesome python developers in person.

Python is used extensively at Google, Dropbox, Quora, Mozilla,Pinterest,Yelp, Youtube and other major tech companies. Here is a list of organisations using python.

How to Learn Python?

The easiest way to learn a programming language is to first learn the basics and then try to build something with it (learn by doing). And it's better if you are building something you are actually interested in rather than something out of a book because it will get you to think about the problem and be more meaningful.

0. Find your motivation

Above all you should be clear as to Why do you want to learn Python? Find what motivates you and write it down. Finding your motivation and sticking to it is the key. Motivation is rarely addressed in learning. No matter, what you are interested in can be done with python and there is a getting started tutorial for it.

1. Learn the basics and syntax.

Unless you know the basic syntax, it's hard to implement anything. That said, don't spend too long on this. The goal is to learn the very basics, so you know enough to start working on your own projects in your areas(s) of interest.

2. Make useless programs - Increasingly complex "Hello Worlds"

For a language like python learning the syntax is not hard. Pick a simple book or do some online tutorials. I have listed below 10 most popular resources to learn python. A google search on "learn python online" will also be helpful.

Having grasped the basics, you need to start using the language. Start of with most basic tasks and build on it from there. Go on increasing the complexity of "Hello World".

These will give you three levels of understanding in your language: how to write code in the language; how to write code with multiple moving pieces and some familiarity with the ecosystem; and how to write complex, maintainable code.

Have positive, but realistic expectiations. Expect that it will be difficult at times, but that progress is possible through effort. If the initial expectations are too high, the frustration levels will be higher as well, which will lead you to quit. There will be times when things will become difficult, but progess is possible through effort.

Get Frequent Feedback.

Constant feedback is important to understand one's own mistakes, to increase the changes of improving. Once a mistake is spotted put in deliberate practice to improve. Deliberation here refers to - isolating the error into as small a task as possible and then repeating the task to hard-code it in your brain. This is boring, but several hours a day of the same helps getting good at things.

3. Start a real world project

Project-based learning has been shown to increase retention, especially when the project is important to you. It forces you to create context for your knowledge, creating more ways for your brain to remember what you learned.

Knowledge remains information, until applied. Projects are a great way to learn - they help you realise your limits and surpass them. These projects also help you build a portfolio which you can later show to your future employer.

Python is a really fun and rewarding language to learn, and I think anyone can get to a high level of proficiency in it if they find the right motivation.

Where to learn Python?

We have posted link to 10 online resources to learn python in this article.

To end it all -

image1

Comments