Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #В одну строку через пробел вводится массив из 10 целых чисел. Вывести его четные, затем нечетные элементы
- #Вариант 1
- x = input()
- x = list(map(int, x.split()))
- chetnie = []
- nechetnie = []
- for i in range(10):
- if int(x[i]) % 2 == 0:
- chetnie.append(x[i])
- else:
- nechetnie.append(x[i])
- print(' '.join(map(str, chetnie)))
- print(' '.join(map(str, nechetnie)))
- #Вариант 2
- a = list(map(int,input().split()))
- odd = ' '
- for char in a:
- if char % 2 == 0:
- print(char, end = ' ')
- else:
- odd += str(char) + ' '
- print(odd)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement