New course! Every coder should learn Generative AI!
Try a free lesson+ 8
You can use a while loop and an exit condition. try this:
buf = []
while True:
inp = input('Name: ')
if inp == 'xxx':
break
else:
buf.append(inp)
print(buf)