k=raw_input('Enter a string: ')
if k==k[::-1]:
print 'String is palidrome'
else:
print 'String is not palidrome'
Solve Problems by Coding Solutions - A Complete solution for python programming
Find the Armstrong Number upto a number
# Compatible in Python 2.7
k=int(raw_input('Enter the range of number:'))
for n in range(k):
sum=0
temp=n
y=len(str(n))
while(n>0):
R=n%10
V=R**y
sum=sum+V
n=n/10
if (sum==temp):
print 'Armstrong Number',temp
k=int(raw_input('Enter the range of number:'))
for n in range(k):
sum=0
temp=n
y=len(str(n))
while(n>0):
R=n%10
V=R**y
sum=sum+V
n=n/10
if (sum==temp):
print 'Armstrong Number',temp
Subscribe to:
Posts (Atom)