Basics To Python

Basics To Python

In this article, we are going to see what are the basics to python programming language.

Python is an interpreted, high-level and general-purpose programming language.

To learn python, you first need to Downlod Python - official website and install it on your machine.

Refer to the tutorials listed below to install python.

Table of Contents

1. Syntaxes

To just start with python programming you don't really need to be good in mathematics, or must have learn at least one programming language previously (but this is good if you have).

All you need to understand is syntaxes and some basic logic (common sense) will be required.

Let me show you one such syntax.

print("your message here")

print() is a function in python. It is called a function because of course it performs some function, and that function is to print messages on console (terminal) or cmd if you are on windows.

You can put any message (string) instead of "your message here" in print function. It needs to be enclosed in single/double quotes.

There are lot of such syntaxes in python.

You don't need to remember them all but you need to remember those which are too frequently used such as print().

Basic Logic (common sense)

You must have heard that python is very powerful programming language yet it is easy and requires short code to perform big tasks.

Let's take another example. Before that you need to know what is a variable.
A variable is very simple object in python.
Its like a container, if you want to store anything like number, string you can store in it.
Creating and storing is simpler than understanding this.

Syntax for creating variable

variable_name = value

Example of variable in python

number1 = 16
number2=116

To add these two numbers we simply need to use addition symbol +

number1 = 16
number2=116

sum = number1 + number2

print(sum)

Output

132

So that was variable. Now consider two variables whose values are two strings (messages).

message1 = "Hello"
message2="World"

sum = message1 + message2

print(sum)

What do you think, what will be the resultant value of sum variable?

You need to use common sense (simple logic) here, it will concatenate the strings

Output

HelloWorld

If you were to write this example code in C programming language it would at least need 10 to 20 lines of code.

Conclusion

So Syntaxes and basic logic are two basics to python. Those are only two basic things you need in basics to python.

If you think there are more, please share your thoughts in comments.

Comments