Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- from collections import Counter
- z=int(input('Введите минимальное число в массиве: '))
- x=int(input('Введите максимальное число в массиве: '))
- y=int(input('Введите сколько всего будет чисел в массиве: '))
- c=[randint(z,x) for _ in range(y)]
- print('Наш массив: ',c)
- a=Counter(c)
- g=0
- for i in c:
- if a[i]==1:
- g+=1
- print('Количество различных элементов в массиве = ',g)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement