Array Program- to get number of occurrences of specified element
from array import *
count=0
Original_array=array('i', [1, 3, 5, 3, 7, 9, 3, 3, 8, 9, 11])
Num=int(input("Enter the number you want to search: " ))
if Num in Original_array:
for i in Original_array:
if i==Num:
count+=1
else:
continue
print(count)
else:
print("Number does not exist")
Comments
Post a Comment