1. Write a Python code Addition operator.
a=10
b=5
c=a+b
print(c)
2. Write a Python code for Multiplication Operator.
a=10
b=5
c=a*b
print(c)
3. Write a Python code for Division Operator.
a=10
b=5
c=a/b
print(c)
4. Write a Python code for Subtraction Operator.
a=10
b=5
c=a-b
print(c)
5. Write a Python code to find the greatest of 2 numbers.
a=10
b=5
if a>b:
print("A is greatest")
else:
print("B is greatest")
6. Write a Python code to find the greatest of 3 numbers.
a=10
b=5
c=15
if a>b and a>c:
print("A is greatest")
elif b>a and b>c:
print("B is greatest")
else:
print("C is greatest")
7. Write a Python code to display 1 to 5 numbers using FOR LOOP. (Page 166)
for i in range (1,6,1):
print(i)
8. Write a Python code to display 1 to 5 odd numbers using WHILE LOOP. (Page 168)
n=1
while n<=5:
print(n)
n=n+2
print("done")
9. Write a Python code to display the multiplication table of the given number.
Example: Multiplication table of 10
for i in range(1,11):
n=15*i
print(f"{15}*{i}={n}")
0 comments:
Post a Comment