Here, we will figure out how to discover the event of a specific number in an array utilizing python program?
In this article, we would find out about arrays and how to code for an array question inquired?
So beginning we would initially find out about arrays for example what an array is?
ARRAY: An array can be characterized as a compartment object that is utilized to hold a fixed number of estimations of a solitary kind of information.
The fundamental motivation behind an array is to store various things of a similar kind together.
This is the straightforward thought that you have to comprehend about the array, presently beginning with the basic inquiry.
Assume you are given with an array that contains ints. Your assignment is to restore the quantity of 3 in the array.
Count3([1, 2, 3]) = 1 Count3([1, 3, 3]) = 2 Count9([1, 3, 9, 3, 3]) = 3
Here we need to again consider a variable which is at first equivalent to zero to keep the check of various 3 and furthermore our capacity is characterized for nums as our array would just contain whole numbers as referenced before.
def Count3(nums): count = 0 for num in nums: if num == 3: count = count + 1 return count print (Count3([1,2,3,4,3,3,3,]))