I have a list containing a group of numbers (str
) , and I want to check if there is at least one element in the list starting with '+'
.
The problem with my code is that an infinite loop will occur if no number starts with '+'
, I need a better solution?
my_list = ['11112352', '222222003', '5682052003', '21543003', '98756003', '+004454883']
while True:
for number in my_list:
if number.startswith('+'):
break