+ 3
I want to sort numbers in odd even pair but its printing even odd pair
n=int(input()) arr=list(map(int,input().split())) z=[] for i in range(len(arr)): if arr[i]%2!=0: z.append(arr[i]) else: z.append(arr[i]) if len(arr)%2!=0: z.append(0) print(*z)
4 Réponses
+ 3
syed fahad ,
it is not quite clear what you want to achieve.
please make us a sample for input numbers, and what they should look like after sorting.
thanks!
+ 1
You're looking for something like this?
https://code.sololearn.com/cmEfuc5wrgUH/?ref=app
+ 1
Not clear!
Write down
1. input
2. output
0
Want to print in the same order