Count the numbers in a list that are over 100 The function below takes one parameter: a list of numbers (number_list). Complete the function to count how many of the numbers in the list are greater than 100. The recommended approach for this: (1) create a variable to hold the current count and initialize it to zero, (2) use a for loop to process each element of the list, adding one to your current count if it fits the criteria, (3) return the count at the end. student.py 1 - def count_over_100(number_list): # Implement your function here. Be sure to indent your code block!

Respuesta :

Answer:

def count_over_100(number_list):

   count = 0

   for number in number_list:

       if number > 100:

           count += 1

   return count

Explanation:

Create a function called count_over_100 that takes one parameter, number_list

Initialize the count as 0

Create a for loop that iterates through the number_list. Inside the loop, check each number using if-else structure. If a number is greater than 100, increment the count by 1.

When the loop is done, return the count

The function that takes one parameter: a list of numbers (number_list) and count the number greater than 100 is represented as follows:

def count_over_100(number_list):

   count = 0

   for i in number_list:

       if i > 100:

           count += 1

  return count

print(count_over_100([100, 20, 120, 200, 10, 350, 400, 128, 45, 57]))  

A function is declared count_over_100 and the parameter is a list named

number_list.

Then a variable is created called count and initialize to 0.

Then we loop through the number_list .

If any number is greater than 100, the count variable increase.

Finally, we return count

The print function is used to call the function with it parameter .

learn more: https://brainly.com/question/15772977?referrer=searchResults

RELAXING NOICE
Relax