0% found this document useful (0 votes)
7 views3 pages

Basic Python Programs

The document provides basic Python programs for performing arithmetic operations such as addition, subtraction, multiplication, division, and finding minimum and maximum values. It also includes examples of using exponentiation and calculating the area of a circle. Additionally, it demonstrates the use of indentation in control flow statements like if-else and while loops.

Uploaded by

shravaniav2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

Basic Python Programs

The document provides basic Python programs for performing arithmetic operations such as addition, subtraction, multiplication, division, and finding minimum and maximum values. It also includes examples of using exponentiation and calculating the area of a circle. Additionally, it demonstrates the use of indentation in control flow statements like if-else and while loops.

Uploaded by

shravaniav2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

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))

10.Python 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

You might also like