Ask Question
25 January, 23:23

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.

+1
Answers (1)
  1. 26 January, 02:29
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers