In: Computer Science
For the following function, what are the best types for the parameters (can be used for all parameters)? (best = will not cause errors, will compute what is intended.)
For example, if you select "string" that means that a call with 3 string values—add_and_mult("Hi", "bye", "llama") is a great choice.
def add_and_mult(num1, num2, num3): sub_val1 = num1 * 60 sub_val2 = (sub_val1 + num2) * 60 answer = sub_val2 + num3 print("Wow! that's " + str(answer))
A. int
B. float
C. string
D. boolean
ANSWER: Here function given is computing answer which is used the operations like + , * which can be computed easily when you have integer or float numbers so here option (A) and (B) are best choices for this function. I also run your program you can see in the output when we are using string arguments it is giving output but not a good practice according to this function definition but you can also use String also.
OUTPUT WHEN ARGUMENTS AS FLOAT:
OUTPUT WHEN INPUTS ARE INTEGER:
OUTPUT when String inputs: