I'm new to python programming and I'm doing some experiments with it. Hoping my question is not too silly: I'm writing a little program that adds inputs to a list and print it when the input equals to 4, using a while loop. the problem is it never stops to add inputs and print the list. My code is:
S=input()
L=[]
while S!=4:
L.append(S)
if S==4:
break
print(L)
string. when you type in4you are not adding4to the list but"4". You have to cast it tointfirst. Likeint(input())