It’s a very common question among students of varying background, from school goers to aspiring computer engineers. Where to start? Which language they should learn first? Which language is easiest and can be used for variety of applications? I will try to answer these questions in this blog with the help of some examples.
When compared with other programming languages Python is easiest. Python reads like English and is simple to understand for someone who's new to programming.
Now with the help of simple programs I am going to show why Python is easier than other programming language.
Suppose you want to print 'Namaste'. How it can be done in Java, C and Python:
'Namaste' in Java
class Namaste
{
public static void main(String [] args)
{
System.out.print("Namaste!");
}
}
Go to the location where you saved the file.
Compile the code with javac.
Then run the code with java.
Just to print a 'Namaste' you are required to write class, a main method, println statement; after that compile the code and then you will able to run it.
Namaste in C
#include<stdio.h>
Void main
{
printf(“Namaste!”)
}
Compile and run the program.
For a newcomer it is a bit complex to understand it.
Namaste in Python
print ("Namaste!")
Just write one line of code and run. No class, No main method, No curly braces. Obviously, this is much easier to understand even for someone not familiar with programming.
Next example is a program for sum of two numbers:
Sum of two numbers in java
public class Sum
{
public static void main(String [] args)
{
int a,b;
a=10;
b=20;
System.out.println(a+b);
}
}
Sum of two numbers in C
#include<stdio.h>
Void main
{
Int a,b;
a=10;
b=20;
printf(a+b);
}
Compile and run the program.
Sum of two numbers in Python
10 assigned to a, 20 assigned to b and then print sum.
From these two examples, you can see that Python is much easier than other languages. 10-20 lines of code in other languages is converted to just 3-4 lines of code in Python.
Conclusion: If you are a newcomer or even a class VI student you can start with Python. Once you become familiar with one Programming Language, you can go for any other. Python is a versatile, powerful, general-purpose language. You can use it for pretty much anything, from web development to games, which is why a lot of people choose it as a first language.
Comments