Honestly this post with the replies made me kinda laugh
This is obviously too late but with the information you gave it was probably this:
ls=[10,20,30,40,50]
def GetSumFromTwoIndexes(index1, index2):
for i in range(len(ls)):
if(i == index1):
for j in range(len(ls)):
if(j == index2):
print(f"The sum is: {ls[i]+ls[j]}")
GetSumFromTwoIndexes(2, 4)
I have no idea why they ask for a for loop though.
Because without it you could just do
def GetSumFromTwoIndexesWithoutForLoop(index1, index2):
print(f"The sum is: {ls[index1]+ls[index2]}")
GetSumFromTwoIndexesWithoutForLoop(2, 4)