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
satela [25.4K]
1 year ago
13

Copy and paste your code from the previous code practice. If you did not successfully complete it yet, please do that first befo

re completing this code practice.
After your program has prompted the user for how many values should be in the array, generated those values, and printed the whole list, create and call a new function named sumArray. In this method, accept the array as the parameter. Inside, you should sum together all values and then return that value back to the original method call. Finally, print that sum of values.
Computers and Technology
1 answer:
Gre4nikov [31]1 year ago
4 0

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

You might be interested in
Your task is to identify three or more ways that big data is being collected on a regular basis, including one data collection m
attashe74 [19]

Answer:

Data is one of the most valuable resources today's businesses have. ... There are various data-gathering methods you can use with the help of your ... When it comes to data businesses collect about their customers, ... Third-party data offers much more scale than any other type of data, ... Big White Cursor.

Explanation:

4 0
3 years ago
Có n chiếc kẹo và m em bé. Hãy viết chương trình nhập vào hai số nguyên dương n, m và kiểm tra n chiếc kẹo có chia đều được cho
sleet_krkn [62]

uy ako ba yung pilipino dito hi nga kau

5 0
2 years ago
In the context of applications of artificial intelligence (AI), _____ perform well at simple, repetitive tasks and can be used t
Elina [12.6K]

Answer:

The right response is "Robots ".

Explanation:

  • A robot seems to be an independent machine that can detect its surroundings, conduct simulations, as well as take action throughout the modern or actual environment.
  • It is indeed a piece of computer-controlled equipment, which would also be utilized autonomously for carrying out duties or other hazardous tasks.
7 0
3 years ago
If you are going to develop a special computer, what would it be and explain it's purpose.​
Ann [662]

Answer:

It would be to figure out what cancers someone could exactly so no need for a biopsy

4 0
3 years ago
How to change the indent of the list item "regular" on slide 2 to .5 inches in powerpoint?
galina1969 [7]
<span>You can change the identation of text in Powerpoint by right clicking on the list item and selecting, "Format Text". On the paragraph tab, you can adjust the indentation before text as given in inches.</span>
4 0
3 years ago
Other questions:
  • Why are computer programs so much longer now than they were in the late 1980?
    8·1 answer
  • When you make a pointer variable im C++, is star label a must?
    9·1 answer
  • The manager of a sports club has data about the club members' ages in a workbook. He wants to find which age is most common. Whi
    13·2 answers
  • A windows host sends a tcp segment with source port number 1200 and destination port number 25. the sending host is a(n) _______
    10·1 answer
  • // This pseudocode should create a report that contains an
    14·1 answer
  • How do you recognize the brand name of a drug in the package insert?
    15·1 answer
  • What type of cable would you use to connect two hosts together in a back-to-back configuration using twisted pair cable?
    15·1 answer
  • Choose the statement that describes an advantage of paying a bill through the mail with a check.
    6·2 answers
  • Does -8 = -21?<br>[this is NOT a trick question]<br>Yes....?<br>No!​
    12·2 answers
  • You're making great progress on your assignment. You've defined the purpose of your message, identified both the primary and sec
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!