3. Topic
• Arithmetic Operation
• Operator (Arithmetic Operator)
• More Built in Function
• Module (Math)
• Problem Set 1: Arithmetic (15)
4. Summation of two number.
a = int(input())
b = int(input())
sum = a + b
print(sum)
5. Difference of two number.
a = int(input())
b = int(input())
diff = a - b
print(diff)
6. Product of two number.
a = int(input())
b = int(input())
pro = a * b
print(pro)
7. Quotient of two number.
a = int(input())
b = int(input())
quo = a / b
print(quo)
8. Reminder of two number.
a = int(input())
b = int(input())
rem = a % b
print(rem)
9. Find Exponent (a^b). [1]
a = int(input())
b = int(input())
## Exponent with Arithmetic Operator
## Syntax: base ** exponent
exp = a ** b
print(exp)
10. Find Exponent (a^b). [2]
a = int(input())
b = int(input())
# Exponent with Built-in Function
# Syntax: pow(base, exponent)
exp = pow(a,b)
print(exp)
11. Find Exponent (a^b). [3]
a = int(input())
b = int(input())
# Return Modulo for Exponent with Built-in Function
# Syntax: pow(base, exponent, modulo)
exp = pow(a,b,2)
print(exp)
12. Find Exponent (a^b). [4]
a = int(input())
b = int(input())
# Using Math Library
import math
exp = math.pow(a,b)
print(exp)
13. Floor Division.
a = int(input())
b = int(input())
div = a // b
print(div)
a = float(input())
b = float(input())
div = a // b
print(div)
14. Find absolute difference of two number. [1]
a = int(input())
b = int(input())
absdif = abs(a - b)
print(absdif)
15. Find absolute difference of two number. [2]
import math
a = float(input())
b = float(input())
absdif = math.fabs(a - b)
print(absdif)
16. Average of three numbers.
a = float(input())
b = float(input())
c = float(input())
sum = a + b + c
avg = sum/3
print(avg)
17. Area of Triangle using Base and Height.
b = float(input())
h = float(input())
area = (1/2) * b * h
print(area)
18. Area of Triangle using Length of 3 sides.
import math
a = float(input())
b = float(input())
c = float(input())
s = (a+b+c) / 2
area = math.sqrt(s*(s-a)*(s-b)*(s-c))
print(area)
19. Area of Circle using Radius.
import math
r = float(input())
pi = math.pi
area = pi * r**2
# area = pi * pow(r,2)
print(area)
25. Problem Set 1: Arithmetic (15)
• Summation of two number.
• Difference of two number.
• Product of two number.
• Quotient of two number.
• Reminder of two number.
• Find Exponent (a^b).
• Floor Division.
• Find absolute difference of two
number.
• Average of three numbers.
• Area of Triangle using Base and
Height.
• Area of Triangle using Length of 3
sides.
• Area of Circle using Radius.
• Convert Temperature Celsius to
Fahrenheit.
• Convert Temperature Fahrenheit to
Celsius.
• Convert Second to HH:MM:SS.
27. Prepared by
Mun Al Mamun
President
East West University Robotics Club
munewu@gmail.com
T h i s s l i d e i s p r o v i d e a s a c o u r s e
m a t e r i a l i n t h e w o r k s h o p
“ W o r k s h o p O n P y t h o n P r o g r a m m i n g ”
O r g a n i z e d b y
E a s t W e s t U n i v e r s i t y R o b o t i c s C l u b