Given a non-empty array of integers, return the result of multiplying the values together in order
时间: 2023-07-04 17:10:25 浏览: 104
Given an array of integers, return indices of the two numbers
Sure, I can help you with that! Here's a Python function that takes in an array of integers and returns the result of multiplying the values together in order:
```python
def multiply_values(arr):
result = 1
for num in arr:
result *= num
return result
```
You can call this function with an array of integers like this:
```python
my_array = [2, 3, 4, 5]
print(multiply_values(my_array)) # Output: 120 (which is the result of 2 * 3 * 4 * 5)
```
Let me know if you have any other questions!
阅读全文