Skip to content

Instantly share code, notes, and snippets.

@pnija
Created February 20, 2019 06:22
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save pnija/861f732a9fb3fd33f3e384d199dc1c2a to your computer and use it in GitHub Desktop.
Given an array of ints, return the number of times the sequence.. 1, 3, 1, 4 .. appears in the array anywhere.
num_array = list()
num = input("Enter how many elements you want:")
print ('Enter numbers in array: ')
for i in range(int(num)):
n = input("num :")
num_array.append(int(n))
result = dict([(x,num_array.count(x)) for x in num_array if num_array.count(x) > 1])
print (result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment