i try to make program if sum of program 1000 the program wil print finished but if the number when we input = 0 the program return error. i try it with break in python but i dont get the right output. i need your oppinion about this.
this my program
banyak = int(input('Masukan banyak angka yang ingin dimasukkan = '))
for j in range(banyak):
A = int(input("enter the number of 1 : "))
B = int(input("enter the number of 2 : "))
C = int(input("enter the number of 3 : "))
if(A + B + C == 1000):
print("finished")
break
elif(A==0 or B==0 or C==0):
print("error")
break
the program should input :
100
0
output:
error
input:
400
300
300
output:
finished
breakthat stops the loop that bother you ? If you specify a number of round to "play", you may NOT use a break, that stops the loop