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
SVETLANKA909090 [29]
3 years ago
8

Write a function similar to keep_ints like before, but now it takes in a number n and returns a function that has one parameter

cond. The returned function prints out numbers from 1 to n where calling cond on that number returns True.
Computers and Technology
1 answer:
lukranit [14]3 years ago
5 0

Answer:

def make_keeper(n):

   """Returns a function which takes one parameter cond and prints

   out all integers 1..i..n where calling cond(i) returns True.

   >>> def is_even(x):

       # Even numbers have remainder 0 when divided by 2.

       return x % 2 == 0

   >>> make_keeper(5)(is_even)

   2

   4

   """

   def fun(cond):

       for i in range(1,n):

           if(cond(i)):

               print(i)

   return fun

Explanation:

  • Define a function called fun that takes cond as input.
  • loop from 1 to n and display the value if it meets the requirement.
You might be interested in
Choose the correct term to complete the sentence
notka56 [123]

Answer:

popleft

Explanation:

5 0
3 years ago
Your data warehousing project group is debating whether to create a prototype of a data warehouse before its implementation. The
Dvinal [7]

Answer:

Hmmm, what would i recommand i think you Should learn skills and become innovative  

Explanation:

Sir i'm gonna go toilet and come back

7 0
2 years ago
true of false one reason to move to a paperless society is that printers are becoming prohibitively expensive
Yakvenalex [24]
True because printers, which require paper, are becoming more expensive. A paperless society has the advantage of being cheaper in this aspect.
5 0
3 years ago
Value appears on the left hand side of cell <br> true or false
11111nata11111 [884]

Answer:

True

Your welcome

.........

4 0
2 years ago
Read 2 more answers
Write a machine code program for all the following problems. Test to make sure that they work in LC3. It's best to complete each
Usimov [2.4K]

Answer:

Following is given the solution to each part.

All the comments are given above each step so that they can make the logic clear.

I hope it will help you!

Explanation:

8 0
3 years ago
Other questions:
  • [Java] Using the comparable interface
    13·1 answer
  • Please I need help with this !!!! <br> Complete the table given below.
    8·1 answer
  • How many bits are required to encode an image that is 25 pixels wide and 50 pixels tall, if you encode each pixel with 12 bits o
    15·1 answer
  • What will be the output after the following code is executed? def pass_it(x, y): z = y**x return(z) num1 = 3 num2 = 4 answer = p
    7·1 answer
  • In our discussion of Computer Hardware, we talked about three essential hardware components that are there inside every computer
    14·1 answer
  • How did the use of ARPANET change computing?
    14·1 answer
  • 9. Which is an example of a function?<br>(1 Point)<br>=A1 +A2<br>=SUM(A1:A3)<br>=ADD(A1:A3)​
    14·2 answers
  • Write if true or false
    11·1 answer
  • What is the most important job of a web server?
    11·2 answers
  • Think about a career you would like to have 10 years from now.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!