Advertisement
NozdrachevNN

divmod 3 == 0

Jun 29th, 2022
496
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None
  1. from random import randint
  2.  
  3. print('Введите размер массива\n')
  4. N = int(input())
  5. mas = [int(randint(1, 1000)) for i in range(N)]
  6. newMas = [int(i) for i in mas if i % 3 == 0]
  7.  
  8. print('Начальный массив:\n', mas)
  9. print('Массив из чисел которые делятся на 3 без остатка:\n', newMas)
Advertisement
RAW Paste Data Copied
Advertisement