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
BigorU [14]
2 years ago
6

. Write a function sumLastPart which, only using list library functions (no list comprehension), returns the sum of the last n n

umbers in the list, where n is the first argument to the function. (Assume that there are always at least n numbers in the list. For this problem and the others, assume that no error checking is necessary unless otherwise specified. But feel free to incorporoate error checking into your definition.) sumLastPart :: Int -> [Int] -> Int
Computers and Technology
1 answer:
max2010maxim [7]2 years ago
7 0

Answer:

In Python:

def sumLastPart(n,thelist):

   sumlast = 0

   lent = len(thelist)

   lastN = lent - n

   for i in range(lastN,lent):

       sumlast+=thelist[i]

   return sumlast

Explanation:

This defines the function

def sumLastPart(n,thelist):

This initializes the sum to 0

   sumlast = 0

This calculates the length of the list

   lent = len(thelist)

This calculates the index of the last n digit

   lastN = lent - n

This iterates through the list and adds up the last N digits

<em>    for i in range(lastN,lent):</em>

<em>        sumlast+=thelist[i]</em>

This returns the calculated sum

   return sumlast

You might be interested in
A single instruction carried out by a computer is called a what?
pochemuha

Answer:

in computer science, an instruction is a single operation of a processor defined by the instruction set

Explanation:

if you need anymore help let me know :)

6 0
3 years ago
A(n) _____ element, as described by the World Wide Web Consortium (W3C), is an element that "represents a section of a page that
MariettaO [177]

Answer:

B. Aside element

Explanation:

The options for this question are missing, the options are:

A. ​article element

B. ​aside element

C. ​section element

D. ​content element

An aside element is defined as a section of a page that has content that is tangentially related to the content around the element. In other words, the aside element represents content that is indirectly related to the main content of the page. Therefore, we can say that the correct answer to this question is B. Aside element.

8 0
3 years ago
What is local area network​
otez555 [7]

Explanation:

local area network is a computer network that interconnects computers within a limited area such as a residence, school, laboratory, university campus or office building. By contrast, a wide area network not only covers a larger geographic distance, but also generally involves leased telecommunication circuits.

<em><u>hope</u></em><em><u> </u></em><em><u>it</u></em><em><u> </u></em><em><u>helps</u></em>

3 0
3 years ago
Read 2 more answers
Graphic design has as its goal the communication of some __________ message to a group of people.
Aleks [24]
Graphic design has as its goal the communication of some specific message to a group of people.

Specific is your answer.
3 0
3 years ago
One of the First-Generation Computer built in 1942 during the Second World War and fully utilized to compute Military Artillery
Temka [501]
ENIAC, in full Electronic Numerical Integrator and Computer, the first programmable general-purpose electronic digital computer, built during World War II by the United States. American physicist John Mauchly, American engineer J. Presper Eckert, Jr., and their colleagues at the Moore School of Electrical Engineering at the University of Pennsylvania led a government-funded project to build an all-electronic computer.

From Brittanica.com
7 0
2 years ago
Other questions:
  • Find the cell address of first column and last row some one pls answer :'(​
    9·1 answer
  • We can see spreadsheet results graphically by creating:
    15·1 answer
  • he Saffir-Simpson Hurricane Scale classifies hurricanes into five categories numbered 1 through 5. Write an application named Hu
    10·2 answers
  • Which cisco ios command is used to display the current ospf neighbors and their rids?
    11·1 answer
  • ​In sql server, the cursor property ____________________ means that the cursor is used for retrieval purposes only.
    9·1 answer
  • ASAP!!!!****** Need help!!!!
    15·1 answer
  • WAFL (write-anywhere file layout) Select one: a. is a distributed file system b. is a file system dedicated to single user opera
    6·1 answer
  • TODAYS ATTENDANCE QUESTION: Why do you think it is important to be able to measure using a ruler in Technology &amp; Engineering
    7·1 answer
  • A CPU scheduler that assigns higher priority to the I/O-bound processes than the CPU-bound processes causes:
    10·1 answer
  • Non linear editing can cause _____ where edit and re-edit and re-edit again can cause video to be less true than the original ma
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!