pref = [0]_ = input()for liczba in map(int, input().split()): pref.append(pref[-1]+liczba)print(pref)
5 2 3 7 8 1
[0, 2, 5, 12, 20, 21]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!