Search for question
Question

Write a Python program that receives a list L of numbers from the user. The program also receives an index i from the user. If the index iin the correct

range of the list L, then the program prints the sum of all values from the beginning of the list until before the index i.Otherwise, the program prints 0. The program would only accept nonnegative indexes. For example, if the user enters the list 1 23 45and then the index i as 3. Your program should print 6. If the index was 7, the program should print 0. If the index was -1, the program prints0.

Fig: 1

Fig: 2