1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ivahew [28]
3 years ago
7

8.6 Code Practice: Question 2

Computers and Technology
1 answer:
Rina8888 [55]3 years ago
4 0

Answer:

import random

def buildArray(a, n):

   for i in range (n):

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

     

arr = []

def sumArray(a):

   tot = 0

   for i in range(len(a)):

       tot = tot + a [i]

   return tot

       

   

arr = []

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

buildArray(arr, numbers)

print(arr)

print("Total " + str(sumArray(arr)) )

Explanation:

You might be interested in
What is the value of the average variable after the following code is executed? var sum = 0; var prices = [14, 10, 9, 12, 11, 14
Reika [66]

Answer:

The value of average is 11

Explanation:

Analyzing the program line by line

This line initializes sum to 0

var sum = 0;

This line defines an array named prices and it also fills it with integer values.

var prices = [14, 10, 9, 12, 11, 14, 10, 8];

The italicized lines is an iteration that adds every element of prices and saves the result in variable sum

<em>for( var i = 0; i < prices.length; i++ ) { </em>

<em>sum = sum + prices[i]; </em>

<em>}</em>

At this point, the value of sum is 88

The next line divides the value of sum (88) by the length of the array (8) which gives 11.

11 is then saved in variable average

var average = sum/prices.length;

4 0
4 years ago
Need help with 4.7 lesson practice
OverLord2011 [107]

Answer:

1.a

2.sorry cant read it that wekk

3.c

Explanation:

7 0
3 years ago
(true or false) One of the difficult things about working in game design is that while there are many different roles, most of t
patriot [66]
Tbh I think it’s False because most of them don’t match
8 0
3 years ago
Read 2 more answers
I need help, help me please ..​
Leona [35]

Answer:

1. cookies

2.domain name

3.web browser as web saver name

4.html

Explanation:

sana makatulong

4 0
3 years ago
What are the principles of computer programming?
STatiana [176]

The principles of computer programming is, the process of writing, troubleshooting, debugging, and problem solving

3 0
2 years ago
Other questions:
  • A client has macular degeneration resulting in moderate visual impairment. The client works as a data entry clerk and wants to c
    15·1 answer
  • Which feature of Microsoft power point allowed you to put a picture in every slide
    8·1 answer
  • If r is an instance of the above Person class and oddNum has been declared as a variable of type boolean, which of the following
    8·1 answer
  • What type of power flaw involves a fluctuation in voltage levels caused by other devices on the network or by EMI?
    13·1 answer
  • 7.1 What is the basic building block of an 802.11 WLAN? 7.2 Define an extended service set. 7.3 List and briefly define IEEE 802
    5·1 answer
  • Which of the following statements is used to terminate the program when closing the frame?
    12·1 answer
  • Assume that name has been declared suitably for storing names (like "Misha", "Emily" and "Sofia"). Assume also that stdin is a v
    6·1 answer
  • What is the hack of the cookie clicker
    11·1 answer
  • Which of the following choices is evidence that present-day vertebrates shared common ancestors?
    13·1 answer
  • What is the difference between functional and non-functional testing
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!