# -*- coding: utf-8 -*- """ Created on Mon Apr 23 19:05:13 2018 @author: stkarlos """ l = [5,11,22,9,7,11,10] s = 0 i = 0 while s <= 50: s = s + l[i] i = i + 1 print ' the number that is added and surpass 50 into s is %d, leading to s equal to %d and its position was %d.' %(l[i-1] , s, i)