In this blog post series, we will start from the basics of Python and move towards Advanced topics in a progressive manner.
As we know, it is just another programming language like C#, Java etc. I am gonna start directly with programming in Python. Before beginning the basics, for those who doesn’t have python installed in their systems, please download it from the link given: https://www.python.org/downloads/
I would suggest to download a stable release of the IDE.
After installing, we can program in python via dos and IDLE python shell. I will be using the IDLE, but you can use DOS too. Now, let’s start with the basics:
1. Arithmetic Operations:
In Python, we can directly assign any variable with a value which when assigned defines the data type of variable.
So, here, I performed Summation by just following lines of code:
Similarly, we can assign variable with any data type.
2. Print command:
Print is directly done by using the command: “Print(arguments)”, where argument can be a string or a numeral. Ex: Print(“Hello World”)
Assigning array is done this way: arr = [20,30,40,50].
To print an element of array, we can simply use command: Print(arr[element position])
Printing complete array using FOR loop:
Printing series from a particular position in an array:
Let’s try something else too, printing every other element in the array except the current element in ascending order:
Similar operations are used from strings as they are also like arrays, just that array of characters.
Implementing for loop is as simple as possible in python, we need not worry about assigning i with any value like 0 or 1, and there also no need for using parenthesis in for loop making it easy for coding.
Well that’s for today’s getting started post, I will return shortly with my series of posts taking you from the basics to advance in Python.