Question: Assume that you have the following function which accepts a whole number ( i . e . an int ) and returns a fun fact
Assume that you have the following function which accepts a whole number ie an int and returns a fun fact about the given number:
numberfactsentencenumber: int str
Part
When we use the term calling a function, we mean we are trying to use the function in a way consistent with the signature. For example, the signature of numberfactsentence states that it requires a whole number ie an int as an input. Which of the following is a correct call to the numberfactsentence function?
a
b
numberfactsentence
c
numberfactsentence
d
numberfactsentence
e
numberfactsentence
Part
Calling a function does not mean that the value it returns is automatically saved. If we want to save the result of a function, we need to assign the value to a variable. Which of the following is the correct way to assign the result of a call to numberfactsentence to a variable?
a
numberfactsentence fact
b
x numberfactsentence
c
fact numberfactsentence
d
fact numberfactsentence
Part
Write a line of code that calls numberfactsentence with the value Assign the result of the function call to a variable called mysteryfact.
Part
Write a line of code that calls numberfactsentence twice once with and once with Connect the two sentences with the word "and". Do not worry about capitialization issues. You do not need to assign the result to a variable.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
