- Declare an empty array
- Let the user add integers to this array, over and over
- Stop when the user enters -1
- Do not add -1 to the array
- Print the array
So far my code below:
A=[]
while True:
B = int(input("Input a continuous amount of integers"))
A = [B]
print(A)
if B == -1:
break
else:
continue
A.append(B)instead ofA = [B]?A = [B]- This won't work. Here you are creating an array of one element, but your task says that you need to "add integers to array". You need to useappend()method.input("Input a continuous amount of integers"). It should probably say:Input an integer:or something.arrayand alist(here you have alist, not anarray)