14.6k views
1 vote
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.

Sample output with two calls to get_user_num() and one call to compute_avg():

FIXME: Finish get_user_num()

FIXME: Finish get_user_num()

FIXME: Finish compute_avg()

Avg: -1


code to fill in:


''' Your solution goes here '''


user_num1 = 0

user_num2 = 0

avg_result = 0


user_num1 = get_user_num()

user_num2 = get_user_num()

avg_result = compute_avg(user_num1, user_num2)


print('Avg:', avg_result)

User Itay Oded
by
7.8k points

1 Answer

5 votes

Answer:

Replace your solution goes here with the following:

def compute_avg(num1, num2):

func_name = "compute_avg()"

print("FIXME: "+func_name)

return -1

def get_user_num(user_num):

func_name = "get_user_num()"

print("FIXME: "+func_name)

return -1

Step-by-step explanation:

This defines the compute_avg function

def compute_avg(num1, num2):

This sets the function name

func_name = "compute_avg()"

This prints the required output

print("FIXME: "+func_name)

This returns -1

return -1

This defines the get_user function

def get_user_num(user_num):

This sets the function name

func_name = "get_user_num()"

This prints the required output

print("FIXME: "+func_name)

This returns -1

return -1

User Wason
by
6.7k points