0
i want to replace the unit digits of first number and last number, second number and second last number and so on.
Python list assignment n=int(input()) p=n a=[i for i in input().split()] for i in range(n//2): f=list(str(a[i])) g=list(str(a[p-1])) f[-1],g[-1]=g[-1],f[-1] p-=1 print(a) Why replace is not happening? https://code.sololearn.com/cxXBidyV44cK/?ref=app
1 Answer
+ 1
If you print f and g at the end of the loop, you will see, that it works.
However you still need to change a then :)