Now as the introduction is over, let’s head towards the tutorials’ next part. Now let us see some basic data types and syntax to represent them. Note that we are covering ‘Python 3’ in this tutorial which is the latest version of Python and is here to stay.
Writing Your First Code:
Let’s start in a very easy way. We will just kick off with writing ‘Hello World’. To output any text on the screen, we do use print statement in python.
Now let’s take this further and learn some basic operations.
Some other operations are //,** etc.
As you can see above, putting calculations directly into python shell will get you an answer.
Declaring a variable in Python is much easier than you thought. If you have to declare an integer, simply declare as follows.
To print the value of that variable a, just like above enter this code:
To print: print(b)
For declaring string,
Note: Strings can be concatenated using ‘+’ operator.
Also, note that you can assign any value to the same variable at any time. As the declared variable doesn’t have a specific type.
Editors for Python:
As you can see we have posted screenshots of Python Shell, which is installed on Windows. Python can also be used in a simple text editor in Linux. Or you may consider installing some IDEs (Integrated Development Environment).
Now if we have to give you options, take a look at this list (These are Not ordered by any special criteria) :
- Use Pydev plugin
- Komodo IDE
- Wing IDE
- Vim IDE
This is it, for now, more coming in next posts.