Ask Question

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.

+5
Answers (1)
  1. 25 March, 12:49
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers