Question: python programming EASY1 Given space-separated humbers, write a program that prints odd and even numbers alternatively. Odd numbers should be in ascending order, even numbers
python programming


EASY1 Given space-separated humbers, write a program that prints odd and even numbers alternatively. Odd numbers should be in ascending order, even numbers should be in descending order, and the starting number should be an odd number. Input The input will be a single line containing space-separated integers. Output The output should be a single line containing space-separated integers. Odd numbers and even numbers should be printed alternately, with odd numbers in ascending order and even numbers in descending order. The starting number should be an odd number. Constraints In the given input, the count of even numbers and odd numbers is always the same. Explanation For example, if the given 55588 ace-separated numbers are 651074 , - Arrange the odd numbers in ascending order 1, 5, 7. - Arrange the even numbers in descending order 6,4,0. - Arrange the sorted odd and even numbers in alternate order, starting with the odd number. It will be 1,6,5,4,7,0. The output should be Sample Input 1 651074 Sample Output 1 165470 Sample Input 2 139814312152 Sample Output 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
