0
plz give line by line expalanation of below code
x= 0 z= [1,2,3,4,5,6,7,9] for i in z: x= x + i if not(x<5): result=x-i print (result ) break
2 Antworten
+ 4
x=0
z= [1,2,3,4,5,6,7,9]
for i in z:
x= x + i #adding list elements one by one to x,
if not(x<5): #not true until x<5 so when x=6(ie 1+2+3) only it executes if block
result=x-i #subsract current I from x =>6-3
print (result ) #print 3
break #breaking loop
0
thx sirJayakrishna🇮🇳 :}