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
garri49 [273]
3 years ago
11

write a function named list_total that accepts a list as an argument (assume the list contains integers) and returns the cumulat

ive total of the values in the list
Computers and Technology
1 answer:
lutik1710 [3]3 years ago
3 0

Answer:

def listSum(mylist):

  sum =0

  for item in range(0,len(mylist)):

      sum=sum+mylist[item]

  print(sum)

Explanation:

Using the Python programming language, I defined a function as listSum that accepts a list as a parameter and returns the sum of the elements in the list.

The most important logic here is defining the range of elements in the list not to exceed the length of the list using the len function. Then using a for statement, we loop through each element and add them up to a sum variable initially assigned the value of 0.

You might be interested in
what is the software that controls the storage, retrieval and manipulation of database stored in a database
irga5000 [103]
A database management system (DBMS) is the software which controls the storage, retrieval, deletion, security, and integrity of data within a database.
5 0
3 years ago
Your program is going to compare the distinct salaries of two individuals for the last 5 years. If the salary for the two indivi
kirza4 [7]

In python:

i = 1

lst1 = ([])

lst2 = ([])

while i <= 5:

   person1 = int(input("Enter the salary individual 1 got in year {}".format(i)))

   person2 = int(input("Enter the salary individual 1 got in year {}".format(i)))

   lst1.append(person1)

   lst2.append(person2)

   i += 1

if sum(lst1) > sum(lst2):

   print("Individual 1 has the highest salary")

else:

   print("Individual 2 has the highest salary")

This works correctly if the two individuals do not end up with the same salary overall.

4 0
3 years ago
How do you put a picture when you ask a question?
Setler [38]

Answer:

there should be an option to attach an item. if not try pasting it

Explanation:

5 0
4 years ago
Read 2 more answers
What is the biggest disadvantage of copying a worksheet into another workbook?
san4es73 [151]
The answer is B)The worksheets may not work in the new workbook.
7 0
3 years ago
Password combined with pin used as an authentication requirement is an example of:
Bingel [31]
...something that the user knows.
4 0
4 years ago
Other questions:
  • Can you give me a free neon legendary pet in Adopt Me on Roblox!!!​ my user is: IamNathan215
    15·2 answers
  • Which option should you select to ignore all tracked changes in a document
    6·1 answer
  • What is the name of the process of heat transfer in which heat is transmitted through light waves?
    7·2 answers
  • Can I change my brainly username?
    9·2 answers
  • "This part of the computer fetches instructions, carries out the operations commanded by the instructions, and produces some out
    15·1 answer
  • The larger the Word Size of a computer
    6·1 answer
  • If there is only a stop sign posted at a railroad
    9·1 answer
  • If you forget your privacy password what will you do if the ask this question what is the name of one of your teacher?​
    12·1 answer
  • How does Shakespeare immediately introduce Tybalt as a menacing character?
    9·1 answer
  • Read the attached paper titled A Survey of Coarse-Grained Reconfigurable Architecture and comment on it. Make sure to specifical
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!