Advertisement
dtroonn

Untitled

Dec 8th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. from random import randint
  2. from collections import Counter
  3. z=int(input('Введите минимальное число в массиве: '))
  4. x=int(input('Введите максимальное число в массиве: '))
  5. y=int(input('Введите сколько всего будет чисел в массиве: '))
  6. c=[randint(z,x) for _ in range(y)]
  7. print('Наш массив: ',c)
  8. a=Counter(c)
  9. g=0
  10. for i in c:
  11. if a[i]==1:
  12. g+=1
  13. print('Количество различных элементов в массиве = ',g)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement