My code below works for the purpose of the lesson but I would like to the output to print "[‘abc’,‘eck’] instead of [‘a’, ‘b’, ‘c’, ‘e’, ‘c’, ‘k’]
portfolio is empty
stocks = ['abc', 'xyz', 'eck', 'tmb']
portfolio = []
for i in stocks:
if i == 'abc':
portfolio += i
if i == 'eck':
portfolio += i
print portfolio
else:
print "portfolio is empty"