Python Basics

Endless possibilities with Python

Python Basics

110px-Python-logo-notext.svg.png

Python is an interpreted high-level general-purpose programming language. Python's design philosophy emphasizes code readability with its notable use of significant indentation. Its language constructs as well as its object-oriented approach aim to help programmers write clear, logical code for small and large-scale projects.

Let's start with the basics of Python progamming

The Print statement

When getting started with any programming language, it's advisable to run the Hello World Program.

Let's do it!

Source Code

  print('Hello World!')

Output

Hello World!

The If-else statement

For making a decision on something, we use the if-else statement. Suppose we have a variable var with value 2. We want to know if var is odd or even. We use the if-else statement for this.

Source Code

var =2
if(var%2==0):
    print('even')
else:
    print('odd')

Output

even