The code practice illustrates the following concepts:
- Arrays or Lists
- Methods or Functions
<h3>The program in Python</h3>
The program written in Python, where comments are used to explain each action is as follows:
#This imports the random module
import random
#This defines the sumArray method
def sumArray(myList):
#This initializes the sum to 0
isum = 0
#This iterates through the list
for i in myList:
#This adds the array elements
isum+=i
#This returns the sum
return isum
#This gets the number of values
n = int(input("Number of values: "))
#This initializes the list
myList = []
#This iterates from 0 to n - 1
for i in range(n):
#This populates the list
myList.append(random.randint(0,100))
#This prints the list
print(myList)
#This calls the sumArray method
print(sumArray(myList))
Read more about Python programs at:
brainly.com/question/24833629
#SPJ1