Question: 1 0 / 1 4 / 2 0 2 4 E 1 0 1 Fall 2 0 2 4 Exam 1 5 . ) (

10/14/2024
E101 Fall 2024
Exam 1
5.)(15 points) Create a Python program that defines a function named count_1s. This function takes an arbitrarily long list of integers as a parameter. The function should look at each list element to determine if the value is 1. The function should return the total number of times the integer 1 occurs in the list.
The program should call the function with the following list as the argument.
my_list =[1,2,3,4,5,2,3,5,1]
Print the resulting count that is returned from the program.
def (ourt.Is
rhy list (dint

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!