Ask Question
26 March, 17:32

Write a method named buildArray that builds an array by appending a given number of random two-digit integers. It should accept two parameters-the first parameter is the array, and the second is an integer for how many random values to add.

Print the array after calling buildArray.

+2
Answers (1)
  1. 26 March, 20:55
    0
    the code using Python

    Explanation:

    import random

    def buildArray (array, size):

    for i in range (size):

    array. append (random. randint (10, 99))

    def sumArray (array, num):

    sum_array = 0

    for i in range (num):

    sum_array + = array[i]

    return sum_array

    def main ():

    n = int (input ("How many values to add to the array:/n"))

    array = []

    buildArray (array, n)

    print (array)

    num = int (input ("How many values to find sum of array:/n"))

    result = sumArray (array, num)

    print (result)

    main ()
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a method named buildArray that builds an array by appending a given number of random two-digit integers. It should accept two ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers