Computer Science, asked by shaddybablu, 5 months ago

Write a menu-driven program to perform the following:


i.  Check whether a number accepted by the user is  an Armstrong Number or not.

ii.Check whether a number accepted by the user is Palindrome  or not

Pls answer it fast​

Answers

Answered by jai696
4

\huge\red{\mid{\fbox{\tt{Using\: Python\: 3}}\mid}}

def is_armstrong(n):

_sum = 0

digits = list(map(int, str(n)))

for d in digits:

_sum += d ** 3

return "an armstrong" if n == _sum else "not an armstrong"

def is_palindrome(n):

return "a palindrome" if str(n) == str(n)[::-1] else "not a palindrome"

n = int(input("enter num: "))

print(f"{n} is {is_armstrong(n)} number!\n{n} is {is_palindrome(n)} number!")

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Similar questions