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