Answer:
A. The function definition must appear before the function is called
Explanation:
Given
The above lines of code
Required
Determine the error in the program
In python, functions has be defined before they are called but in this case (of the given program), the function is called before it was defined and this will definitely result in an error;
<em>Hence, option A answers the question</em>
The correct sequence of the program is as follows:
<em>def evenOdd(n):
</em>
<em> if n % 2 == 0:
</em>
<em> return "even"
</em>
<em> return "odd"
</em>
<em>num = int(input("Enter an integer: "))
</em>
<em>print("The integer is", evenOdd(num))
</em>
<em />
Computer simulation is just like training for example before pilot fly plane they got training from computer simulation it's just like video lecture
Answer: True
Explanation:
Subset sum problem and Knapsack problem can be solved using dynamic programming.
In case of Knapsack problem there is a set of weights associative with objects and a set of profits associated with each object and a total capacity of knapsack let say C. With the help of dynamic programming we try to include object's weight such that total profit is maximized without fragmenting any weight of objects and without exceeding the capacity of knapsack, it is also called as 0/1 knapsack problem.
Similar to knapsack problem, in subset sum problem there is set of items and a set of weights associated with the items and a capacity let say C, task is to choose the subset of items such that total sum of weights associated with items of subset is maximized without exceeding the total capacity.
On the basis of above statements we can say that subset sum problem is generalization of knapsack problem.