Write a Python code that will read 5 numbers from the user. Your program should print the first number, the sum of the first 2 numbers, the sum of the first 3 numbers, and so on up to the sum of 5 numbers.
==========================================================
Sample Input 1:
1
2
3
4
5
Sample Output 1:
1
3
6
10
15
in_ = [int(input(f'Input number {i+1}: ')) for i in range(5)]
print('='*20)
[print(sum(in_[:i])) for i in range(1,len(in_)+1)]
Comments
Leave a comment