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
Sonbull [250]
3 years ago
7

Write a function (funception) that takes in another function func_a and a number start and returns a function (func_b) that will

have one parameter to take in the stop value. func_b should take the following into consideration the following in order: Takes in the stop value. If the value of start is less than 0, it should exit the function. If the value of start is greater than stop, apply func_a on start and return the result. If not, apply func_a on all the numbers from start (inclusive) up to stop (exclusive) and return the product.
Computers and Technology
1 answer:
castortr0y [4]3 years ago
3 0

Answer:

The code for this question can be defined as follows:

def funception(func_a, start):#define a method funception that accept two parameter

   def func_b(stop): #define a method func_b that accept one parameter

       if start < 0:#define if block that checks start parameter value less then 0

           return #Use return keyword

       if start > stop:#define if block that checks start parameter value greater then stop parameter value

           return func_a(start)#use return keyword to call func_a method

       else:#define else block

           product = 1#define a variable product and assign a value 1

           for i in range(start, stop):#define for loop to calculate the value

               product= product * func_a(i)#multiply the method value in product variable

           return product#return prod value

   return func_b#return func_b value

def func_a(num):#define a method func_a that accept a num variable as a parameter

   return num + 1#use return keyword by increment num value by 1

Explanation:

In the above python program code, a method "funception" is defined that accepts two parameters that are "func_a and start", in which "func_a" is a method name, that accepts a "num" variable in its parameter and returns its one increment value.

  • Inside the method, another method that is "func_b" is defined that accepts a "start" variable in its parameter and uses it if block to check "start and stop" values.
  • If the start value is less then 0 it will exit the program. If the start value is less then stop value so, it will return the "func_a" value.
  • In the else part, a "product" variable is defined that multiplies the method "func_a" value and returns its value.
You might be interested in
g A user receives an email from an unknown source with a link to a website asking for their password. The userenters in their pa
SCORPION-xisa [38]

Based on the information provided, this user is a victim of phishing.

<h3>What is phishing?</h3>

Phishing can be defined as a type of cyberattack which involves making an attempt to obtain sensitive user information such as a password, especially by disguising as a trustworthy entity in an electronic communication (email), which is usually over the Internet.

In this context, we can infer and logically deduce that this user is a victim of phishing because he or she received an email from an unknown source with a link to a website asking for their password.

Read more on phishing here: brainly.com/question/23850673

#SPJ1

5 0
2 years ago
What built-in function should you use in python to prompt a user for data input?
stiks02 [169]

The built-in function you use in python to prompt a user for data input is the input function.

<h3>What is an input function?</h3>

An input function is a function used to prompt a user for data input.

The data input may be a string, integer, float, and many more.

Let's use an example of an input function in python.

x = input("what is your name: ")

y = int(input("How old are you: "))

Hence, the first input will prompt the user for the name and the second input will ask the user for his age. It can only accept integers.

learn more on input function here: brainly.com/question/17623507

#SPJ12

5 0
2 years ago
Read 2 more answers
In computer science what major jobs is appropriate for someone who majors in information systems
AURORKA [14]

Answer:

manager

Explanation:

7 0
4 years ago
What is character encoding?
andrew11 [14]

Answer:   A character encoding provides a key to unlock (ie. crack) the code. It is a set of mappings between the bytes in the computer and the characters in the character set. Without the key, the data looks like garbage. The misleading term charset is often used to refer to what are in reality character encodings.

Explanation:

4 0
3 years ago
Explain how the CPU processes data instructions
zepelin [54]

Answer: The working of the CPU is defined as a three-step process. First, an instruction is fetched from memory. Second, the instruction is decoded and the processor figures out what it's being told to do. Third, the instruction is executed and an operation is performed.

Explanation: Hope this helps

6 0
3 years ago
Other questions:
  • HELP ASAP- YOU GET BRAINLIEST!!
    13·1 answer
  • A new employee has reported that print jobs are printing as garbled text. Which of the following is MOST likely the reason for t
    8·1 answer
  • Answer ASAP and I'll give brainliest.
    10·2 answers
  • The find and
    10·1 answer
  • Write Python programs to solve the following two problems. Your programs should be named according to the problem descriptions a
    9·1 answer
  • . ____________is/are the JSP ImplicitObject(s).sessionapplicationconfigAll of GivenNone of Given
    9·1 answer
  • My cell phone rear camera is dirty does anyone know how to clean it?
    14·2 answers
  • Which of the following describe design themes in PowerPoint? Choose all that apply.
    10·1 answer
  • Charli D'amelio bought her followers. <br><br> True or true? ;)​
    15·2 answers
  • John is writing a code instructing the character to move forward 10 steps, choose a number between 1 to 10, and if the number is
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!