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
PLEASE HELP
kap26 [50]

Answer:

dog

Explanation:

The python program has four lists, A, B, C, and E which is a list of the first three lists. Lists are unordered indexed data structures, it is accessed by an index starting from 0 to n (which is the length of the list minus one).

The E list is a list of lists with three list items starting from index zero to two. E[0][1] is used to access the item "dog" in the first list item of the E list.

3 0
2 years ago
Which of the following is an online library?
Mice21 [21]
Answer A. Hope it helped c:
4 0
3 years ago
Read 2 more answers
Anyone who uses Edmentum Plato homeschool can anyone please help me my biology is not loading and it says flash is not available
Pavlova-9 [17]
Turn off your computer, wait 10 minutes, turn it back on. Open your browser, and go to the website. If it is still not working, I would assume that this is not a problem with your computer, but the network was not loaded properly, and should be fixed with some patience. In the mean time, you may have the day off.
8 0
3 years ago
Read 2 more answers
What is the purpose of a report?
Tanzania [10]
C to organize data in a table
4 0
3 years ago
A _____ is relatively inexpensive to install and is well-suited to workgroups and users who are not anchored to a specific desk
KengaRu [80]

Answer:

B) wireless local area network (WLAN)

Explanation:

WLAN which fully meaning is WIRELESS LOCAL AREA NETWORK is a network provider that enables two or more mobile phone user , desktop or computer user to connect and have access to the internet by simply connecting to the local area wireless network and this type of wireless network are more cheaper to install.

Example of where WIRELESS LOCAL AREA NETWORK can be found are : School building, Office building, School campus, home, among others.

4 0
3 years ago
Other questions:
  • What is the main role of LDAP?
    6·1 answer
  • The term load is often used to describe opening a page in a ____. Answer
    11·1 answer
  • Use the RSA cipher with public key n = 713 = 23 · 31 and e = 43. Encode the word "KING" into its numeric equivalent and encrypt
    15·1 answer
  • What is out put.what is data. what is microprocessor
    14·1 answer
  • Help me on this question
    14·1 answer
  • If there are 8 opcodes and 10 registers, a. What is the minimum number of bits required to represent the OPCODE? b. What is the
    10·1 answer
  • The __________ utility has the capability to manage users, create and administer user groups, and apply user rights to those use
    8·1 answer
  • Which software programs should students avoid using to create and submit course work? (Choose all that apply).
    6·1 answer
  • Pls help now the question is very hard someone help me pls​
    6·1 answer
  • Write an<br>algorithm and draw flow chart to<br>find greatest among 2 numbers​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!