177k views
5 votes
Define stubs for the functions get_user_num() and compute_avg(). Each stub should print "FIXME: Finish function_name()" followed by a newline, and should return -1. Each stub must also contain the function's parameters.

User Rudnev
by
3.5k points

1 Answer

5 votes

Final answer:

Stubs for get_user_num() and compute_avg() are placeholders in code that print a message to indicate they are incomplete and return -1. They include the necessary parameters for their eventual implementation but do not use them within the stubs.

Step-by-step explanation:

The question asks to define stubs for two functions: get_user_num() and compute_avg(). In programming, a stub is a piece of code used to stand in for some other programming functionality during development. The purpose of a stub is to simulate the behavior of original code without its full implementation.

The stub for get_user_num() might look like this:

def get_user_num():
print("FIXME: Finish get_user_num()\\")
return -1

And the stub for compute_avg() could be:

def compute_avg(num1, num2):
print("FIXME: Finish compute_avg()\\")
return -1

Both stubs follow the instructions to print a message indicating that the function needs to be completed and return -1. They also include the necessary parameters, even though the parameters are not used in the stub implementation.

User Chan Kha Vu
by
3.7k points