2-Salient Features of Python - II
2-Salient Features of Python - II
In Python
if num%2 == 0:
if num%3 == 0:
print ("Divisible by 3 and 2")
else:
print ("Divisible by 2 not divisible by 3")
else:
if num%3 == 0:
print ("Divisible by 3 not divisible by 2")
else:
print ("Not divisible by 3 nor by 2")
2. Dynamic typing
In Python, a variable to be used in a program need not have prior declaration of its
name and type. You will learn details about variables in the next module.
3. Interpreted language
Python is an interpreter-based language. An interpreter executes one instruction at a
time. So if there is an error on line 7 of the code, it will execute instructions till line 6
and then stop. This is unlike a compiler which will not execute any of the instructions
even if there is a single error. Thus, an interpreter is useful if you are new to
programming because it allows you to see partial output of your code and identify the
error location more easily.