Computer Science, asked by shivaswamy6, 5 months ago

2) WAP to accept n numbers in an array and display all the unique

numbers present in it using the following method.

boolean checkUnique(int x) To check if x is a unique number or not.

A number is a unique number that starts and ends with the same digit​

Answers

Answered by jai696
9

\large\mathsf\color{pink}{Solution\: using\: python\: 3}

def checkUnique(x):

ints = [n for n in str(x)]

return ints[0] == ints[-1]

nums = [int(n) for n in input("enter nums: ").split()]

unique_nums = [str(n) for n in nums if checkUnique(n)]

print("\n".join(unique_nums))

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

Similar questions