Question: Implement a Python function named number _ divisible that takes a list of integers and a integer n as input parameters and returns the number

Implement a Python function named number_divisible that takes a list of integers and a integer n as input parameters and returns the number of elements in the list that are divisible by n. Then, in the main, your program should ask the user to input integers for the list and an integer for n, then it should call the function number_divisible, and print the result. In this question you may assume that the user will follow your instructions and enter a sequence of integers separated by spaces for the list and an integer for n. You can use str method .strip and .split to handle the user input. Here is a way to ask a user for a list: raw_input = input("Please input a list of numbers separated by space: ").strip().split() But now raw_input is a list of strings that look like integers so you need to create a new list that is a list of equivalent integers. Function call example: >>> number_divisible([6,10,2,3,4,5,6,0],3)

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!