Question: 1)) The following function is supposed to compute and display the value of n-factorial for integers greater than 0. def factorial(n): result = 1 for

1))

The following function is supposed to compute and display the value of n-factorial for integers greater than 0.

def factorial(n): result = 1 for i in range(1, n + 1): result = result * i 

What is wrong with this function?

The indenting is wrong. All of the lines should be indented by the same amount.

The calculation is wrong. The result variable will have something other than n-factorial stored in it.

The function is missing a line. A print statement must be added at the end of it.

The function is missing a line. A return statement must be added at the end of it.

2)

 1)) The following function is supposed to compute and display the

3)

value of n-factorial for integers greater than 0. def factorial(n): result =

4)

1 for i in range(1, n + 1): result = result *

5) The following function is supposed to compute the area of a triangle and return the area as the function's result.

def triangle_area(base, height): area = base * height / 2 ____________________ 

What line of code must be placed in the blank to achieve this goal?

print area
print(area)
return area
return triangleArea

Given the following code snippet, what is the value of the variable removed_value? states - ["Alaska", "Hawaii", "Florida" "Maine", "Ohio,"Florida" removed_value - states.pop(3) 0 3 Maine Florida Hawaii

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!