Answer to Question #350129 in Python for Rohith

Question #350129

Number 2 present at index locatios 0,6,9, as the last occurrence, is at index 9. So the output should be 9.




Input: 2 4 5 6 7 8 2 4 5 2 3 8



9

1
Expert's answer
2022-06-13T08:26:35-0400
nums = [int(n) for n in input().split()]
for i in range(len(nums), 0, -1):
    if nums[i-1] == 2:
        print(i-1)
        break

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS