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 is one invention that has had an impact on the way you live?<br><br>Write an essay
xz_007 [3.2K]
My phone duhhh. If I hadn’t had a phone I wouldn’t be able to send streaks...
8 0
3 years ago
Read 2 more answers
Point: A Point in a two dimensional plane has an integer x coordinate value and an integer y coordinate value.
UNO [17]

Answer:

They are connected

Explanation:

8 0
2 years ago
Weakness in software can be more quickly uncovered and exploited with new software tools and techniques.
grandymaker [24]
False because it might damage it more but if it was recommended by lots of people i mean the software then its true
6 0
3 years ago
You can use the Trim Video feature to specify a video file’s Start and End time in order to control which portion of the video f
mario62 [17]

Answer:

True

Explanation:

You can trim a video and actually set the start time and end time of a video on Powerpoint (a presentation software by microsoft) by following some simple steps.

select the video and click the playback tab, click the Trim video and a box will pop up, you can play the video and see how it is trimmed, and finally click OK.

5 0
3 years ago
Why are 90% of questions not being answered im scrolling through the questions. Most are not being answered except the easy ques
Anna [14]
I actually have this problem all the time. Rarely any of my questions get answered and I see this happening to other people all the time. It's crazy. 
5 0
3 years ago
Read 2 more answers
Other questions:
  • Assume that a kernel is launched with 1000 thread blocks each of which has 512 threads. If a variable is declared as a shared me
    6·1 answer
  • _ includes websites that encourage interaction and connection among people, businesses, and organizations.
    5·1 answer
  • Esther has acquired an associate's degree in information technology and certifications in PageMaker and Illustrator. Which caree
    8·2 answers
  • Write a class named Episode. An instance of this episode class will represent a single episode of a TV show, with a title, a sea
    12·1 answer
  • teve wants to use Google Display Ads to reach new customers who are looking to purchase products similar to his. Which audience
    14·1 answer
  • Apple users tend to like the company and love its products. Apple has successfully nurtured this __________ component of its cus
    15·1 answer
  • All states that have altered judicial selection techniques in recent years have adopted some form of:
    5·1 answer
  • Robert gets home from school at 3 p.M. His mom has to leave for her shift at work at 3:15 and she wants him to watch his baby br
    9·1 answer
  • Jill is configuring the AutoArchive feature in Outlook 2016. What is the default setting in relation to when AutoArchive
    8·1 answer
  • I WILL GIVE BRAINLIST THING TO WHOEVER GIVES ME THE CORRECT ANSWER
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!