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
What usually happens during the investigation & analysis stage of the Systems Life Cycle
aleksandr82 [10.1K]

Answer:

ah th gyroscope RR et et yet drug RAC Sybille et kg

7 0
3 years ago
Edhesive silly questionsj
Alex17521 [72]
Mnhhbjhhhhdndkdjdjddnnxnx
4 0
3 years ago
Paths describe the location of folders and files on your computer. If you have saved your work to c:\documents, then your work h
swat32
The answer is D and it can also be C
3 0
3 years ago
Help fast plzzzzzzzzzzzz ​
eimsori [14]

Answer:

Which question would you like help with?

4 0
3 years ago
Read 2 more answers
Need help with this
andrezito [222]

Answer:

13:a. 15:c. 14:Unknown answer

6 0
3 years ago
Other questions:
  • What precaution can you take while using a social networking site to prevent a data breach?
    15·1 answer
  • According to COSO, which of the following components addresses the need to respond in an organized manner to significant changes
    14·1 answer
  • vulnerability is a feebleness which allows an attacker to condense a system's information assurance to security,is it true or fa
    14·1 answer
  • Web 2.0 has led to a shift just from consuming content towards what
    6·1 answer
  • The merge sort algorithm sorts using what technique?
    8·1 answer
  • The process of combining rows and columns in a table is called _____.
    8·1 answer
  • Which of the following contributes to your active digital footprint
    12·2 answers
  • From which of the following locations can you run a single line of the program?
    12·1 answer
  • Running away from home
    11·2 answers
  • A technology _________ occurs when the ability of a company to operate is impaired because of a hardware, software, or data outa
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!