python_logo

Python:Simple Yet Powerful

Are you new to the world of  programming?If yes, you must be anxious about learning the fundamentals and build a solid foundation in the field of software engineering.But wait, is the syntax of programming languages are so overwhelming to you that you are already loosing hope? Don’t worry because python is savior.Trust me, as they say, literally Python is Beautiful.

python_logo
Python: The Best Place to Begin

To give you a simple example, if you are little familiar with java you know how tough it is to write a simple print statement of “Hello World” . “system.out.println(“Hello World”);”.It is difficult to type such long commands and understand what it really means for a beginner.Also, if you forget that tiny semi-colon, you will get compilation error. Now you see how to do it in python.

print(“Hello World”)

That is all you need and it will work for you. isn’t it really interesting?  I will give few more example how we can easily get the stuff done without using any difficult syntax.Suppose you want to print the elements in an array along with their index.Here is the code to do it in a simple manner.

list1=[20,30,10,20,10]
for i,value in enumerate(list1):
print (i,value)

Output:

0 20
1 30
2 10
3 20
4 10

Now, Suppose you want to print two list of equal length simultaneously.Generally, most programmers will use nested for loop.

list1=[2,3,1,2,1]

list2=[3,4,6,1,7]
for a, b in zip(list1,list2):
print (a)
print (b)                                                                                                                                                                                print(“———“)

output:

2
3
——
3
4
——
1
6
——
2
1
——
1
7
——

So, by now you have realized how powerful python can be with its rich set of functionality.At least you can correlate with any other language and easily identify the simplicity with which it performs the complex operations.In future post we will see more stuffs that python is capable of and develop some strong foundations of computer science using them.

 

 

 

About: Abhaya


One thought on “Python:Simple Yet Powerful”

Leave a Reply

Your email address will not be published. Required fields are marked *