write a python program to reverse digits of each element of list. For eg- if number is 123, it should give the output as 321
Answers
Answered by
1
Heya friend,
Here we go:
SOURCE CODE
#reverseing digits of each elements in a list
a=eval(input('Enter the list of numbers:'))
l=len(a)
for i in range (l):
b=0
while a[i]!=0:
b=b*10+a[i]%10
a[i]=a[i]//10
a[i]=b
print()
print('List after reversing digits of each elements of list is:','\n')
print(a)
OUTPUT
Enter the list of numbers: [123, 586, 947]
List after reversing digits of each elements of list is:
[321, 685, 749]
>>>
Enter the list of numbers: [1234,789, 4567]
List after reversing digits of each elements of list is:
[4321, 987, 7654]
>>>
Thanks !
#BAL #answerwithquality
@MANAV
Similar questions