Basic Programs in Python
1. Add Two Numbers in Python
a = 15
b = 12
res = a + b
print(res)
2. Subtract Two Numbers in Python
a = 15
b = 12
res = a - b
print(res)
3. Multiply Two Numbers in Python
a = 15
b = 12
res = a * b
print(res)
4. Divide Two Numbers in Python
a = 15
b = 12
res = a / b
print(res)
5. Integer division of Two Numbers in Python
a = 15
b = 12
res = a // b
print(res)
6. Minimum of two numbers in Python
a=7
b=3
print(min(a, b))
7. Exponent of two Numbers
a=7
b= 3
print(a**b)
8. Exponent of two Numbers using pow
a=7
b= 3
print(pow(a,b))
9. Find Maximum of two numbers in Python
a=7
b=3
print(max(a, b))
[Link] Program to Find Area of a Circle(Area = pi * r2)
PI = 3.142
r = 5 # radius
area = PI * (r * r)
print(area)
Indentation in Python
if 10 > 5:
print("This is true!")
print("I am tab indentation")
print("I have no indentation")
a = 20
if a >= 18:
print('Hello...')
else:
print('Hi')
print('All set !')
j=1
while(j<= 5):
print(j)
j=j+1