Write a python function Sum(ele) which takes a comma-separated string of numbers and returns the reverse of the sum of the smallest and largest numbers in the given list as shown in the example. For example, for the list 10, 23, 14, 25, the sum of smallest and largest numbers is 35. And the reverse of 35 is 53.
NOTE:
def Sum(ele):
list_ele = list(map(int,ele.split(',')))
Max = max(list_ele)
Min = min(list_ele)
rev = 0
temp = Max
while temp != 0:
rev = rev*10 + temp%10;
temp //= 10
return {Max + Min,rev}
ele = input()
sum_of_ele, reverse = Sum(ele)
print(sum_of_ele,reverse)
Comments
Leave a comment