1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
KiRa [710]
2 years ago
15

Complete the divisible_by(list1, int1) function below. As input, it takes a list of integers list1 and an integer int1. It shoul

d return a list with all the integers in list1 where the integer is divisible by int1. For example, divisible_by([2, 9, 4, 19, 20, -3, -15], 3) should return the list [9, -3, -15].
1 def divisible_by(listi, n):
2 # code goes here
3 pass
4
5 if _name == "__main__":
6 # use this to test your function
7 test_list = [2, 9, 4, 19, 20, -3, -15]
8 print(divisible_by(test_list, 3))
Computers and Technology
1 answer:
damaskus [11]2 years ago
5 0

Answer:

The function is as follows:

def divisible_by(listi, n):

   mylist = []

   for i in listi:

       if i%n == 0:

           mylist.append(i)

   return mylist

   pass

Explanation:

This defines the function

def divisible_by(listi, n):

This creates an empty list

   mylist = []

This iterates through the list

   for i in listi:

This checks if the elements of the list is divisible by n

       if i%n == 0:

If yes, the number is appended to the list

           mylist.append(i)

This returns the list

   return mylist

   pass

You might be interested in
I need help please?!!!
PolarNik [594]

Answer:

Turn on the defroster. obv

Explanation:

7 0
3 years ago
Read 2 more answers
Attackers will sometimes put malware on USB drives and leave them in parking lots
kherson [118]

Answer:

True

Explanation:

a lot of people use this as a way to keep things nice and safe, but sometimes thinks don’t go as planned. Don’t really know how else to answer this lol

6 0
1 year ago
HELP asap please... ​
Usimov [2.4K]

Answer:

I have absolutely no idea bruddah.

Explanation:

Soz!

8 0
3 years ago
Assuming that the message variable contains the string "Happy holidays", the statement message.find("days"); returns a. -1b. 10c
katrin [286]

Answer:

Answer is b. 10                

Explanation:

The find() method is used to search the string for a specified value and searches the first occurrence of that value. It returns the position of that specified value. If the value is not found, this method returns -1.

Lets say we have a message variable that contains the string Happy holidays.

message = "Happy holidays"

We use the method find() to find days word from the Happy holidays string in the message variable.

The find() method will find the position of day.

If we look at the string Happy holidays we see that the word day is at the 10th position of the string.

H     1

a      2

p      3

p      4

y      5

h      6

o      7

l       8

i       9

d      10

a      11

y      12

s      13

So it is at 10th position so the statement

message.find("days")

returns 10

7 0
3 years ago
What are the three parts of a camera
son4ous [18]

Answer: Camera lens, Film or sensors, and body.

Explanation: I researched it.

8 0
2 years ago
Other questions:
  • Which of these statements is true?
    9·1 answer
  • _______ are unprocessed facts that a computer feeds on.
    5·1 answer
  • The ____ aggregate function finds the largest value
    10·1 answer
  • My friend has a battery of 9000mah and loses 10 every day how many days well it take to go to zero
    13·1 answer
  • Students enrolled in a digital classroom participate in discussions and take field trips with classmates. watch instructional vi
    11·1 answer
  • Universal Containers has two customer service contact centres and each focuses on a specific product line. Each contact centre h
    7·1 answer
  • 2. Write a Python regular expression to replace all white space with # in given string “Python is very simple programming langua
    14·1 answer
  • What is functionality criteria or alternative word
    8·1 answer
  • Given the following statement, what is the value of myExample?
    13·1 answer
  • Help please i will give Brainliest
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!