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]
3 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]3 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
Select all that apply.
Valentin [98]

Answer:

1, 3, & 4.

Is the way to do so. Good luck.

6 0
3 years ago
A doge is a shiba inu or probably a meme
Doss [256]
Yes the doge is a shiba
7 0
3 years ago
Read 2 more answers
__________ requires unbiased and careful questioning of whether system elements are related in the most effective ways, consider
Liono4ka [1.6K]

Answer:

The answer is "Critical analysis".

Explanation:

Critical analysis is a part of the operating system, that provides an analysis, which is used to process all bits in a system and run their computer system more efficiently.

  • This analysis is used in contextual writing because It reflects the author's interpretation or perception of the text.
  • This analysis hosts vulnerabilities in current desktop operating systems objectively.
5 0
3 years ago
B. START: What new information, strategies, or techniques have you learned that will increase your technology skills? Explain wh
Komok [63]

It is important to star typeing rather than know how to have all the little secrets.

7 0
3 years ago
What is the fundamental goal of outsourcing? increased quality brand expansion cultural diversity cost savings
galben [10]

Answer:

Cost saving is the fundamental goal of outsourcing.

Explanation:

Initially the companies where outsourcing task only for Cost cutting. But nowadays, the companies do that for so many other reasons like, increase the efficiency, reducing overhead, to concentrate on core business peacefully, to obtain more profit, etc.  

The cultural diversity does not affect or make companies to outsource.

We can indirectly increase the quality but it is not the primary goal of outsourcing.  

Brand expansion will holds good, only the BPO is run under the name of the company. But this is once again not the major objective.

7 0
3 years ago
Other questions:
  • The Caesar Cipher has 25 different shifts to try.
    14·1 answer
  • Black Ops 3 For Ps4 Players Here
    7·1 answer
  • Which of the following should you NOT do when using CSS3 properties to create text columns for an article element? a. make the c
    12·2 answers
  • Write structured pseudocode to show the following: print “Reorder” when the quantity is less than 20; otherwise print “OK”.
    15·1 answer
  • WHAT 1 + 1 ???? ???????????????????
    15·2 answers
  • What is the correct order of the phases of the software development process?
    14·1 answer
  • Problem: Mr. James Reid, the director of admissions at MOGCHS University, has
    14·1 answer
  • The system where the unit of measurement is centimeter
    15·1 answer
  • Place the steps for attaching a file to a message in order from top to bottom.
    12·1 answer
  • Write the icon of full justification​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!