Neelasmeeta. Computer
Neelasmeeta. Computer
ROLL NO.: 04
SECTION: A
BATCH:
B.SC(HONS)
FORENSIC SCIENCE
SUBJECT: PYTHON
PROGRAMMING
Write a python program to check whether a number is
prime or not.
n=int(input("enter a number"))
lb=2
ub=n-1
c=0
for i in range(lb,ub+1):
if n%i==0:
c=c+1
if c==0:
print("It is a prime number")
else:
print("It is not prime")
n=int(input("enter a number"))
lb=1
ub=n
for i in range(lb,ub+1):
if n%i==0:
print(i)
Write a python program to check whether a number is
perfect or not.
n=int(input("enter a number"))
m=n
lb=1
ub=n-1
s=0
for i in range(lb,ub+1):
if n%i==0:
s=s+i
if s==m:
print("Perfect number")
else:
print("Not a perfect number")
n=int(input("enter a number"))
d=0
s2=0
m=n
s=n**2
while(n>0):
d=d+1
n=n//10
f=10**d
s2=s%f
if (s2==m):
print("automorphic")
else:
print("not automorphic")
lb=1
ub=100
for i in range(lb,ub+1):
if i%3==0:
print(i)
By the input of a person’s age find out the age group
(child, teenager, adult, senior).