Python Assignment #4
1. Write a program to print first 10 natural number.
2. Write a program to print first 10 even numbers.
3. Write a program to print first 10 odd numbers.
4. Write a program to print first 10 even numbers in reverse order.
5. Write a program to print table of a number accepted from user.
6. Write a program to display product of the digits of a number
accepted from the user.
7. Write a program to find the factorial of a number.
8. Write a program to find the sum of the digits of a number accepted
from user
9. Write a program to check whether a number is prime or not.
Write the output of the following code :
x=5
while(x<15):
print(x**2)
x+=3
a=7
b=5
while(a<9):
print(a+b)
a+=1
b=5
while(b<9):
MSBTE NEXT ICON COURSE YOUTUBE CHANNEL – UR ENGINEERING FRIEND
print("H")
b+=1
b=15
while(b>9):
print("Hello")
b=b-2
x=15
while(x==15):
print("Hello")
x=x-3
x = "123"
for i in x:
print("a")
i=9
while True:
if i%3==0:
break
print("A")
a=5
while(a<=10):
print("a")
a+=1
i=0
while i<3:
print(i)
i=i+1
else:
print(7)
MSBTE NEXT ICON COURSE YOUTUBE CHANNEL – UR ENGINEERING FRIEND
i=0
while i<3:
print(i)
i=i+1
print(0)
i=2
for x in range(i):
i+=1
print(i)
print(i)
i=2
for x in range(i):
x+=1
print(x)
print(x)
i=2
for x in range(i):
x+=1
print(x)
print("x")
i=100
while i<57:
print(i)
i+=5
MSBTE NEXT ICON COURSE YOUTUBE CHANNEL – UR ENGINEERING FRIEND