You only like numbers that start with an odd digit. Anil gives you space-separated integers as input. Your task is to left - rote every number in the list (if required) so that it can be liked by you.
Note:
• If there is no odd digit in the number, do not rotate it.
• If a number starts with an odd digit, do not rotate it.
def func1(list1):
list2 = []
for i in list1:
j = str(i)
if int(j[0]) % 2 == 0:
for k in range(len(j)):
j[k] = j[len[j]-k-1]
list2.append(j)
return list2
func1([12, 252,2125])
Comments
Leave a comment