19/19 - code technically works but i need some help


#1

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"

#2

Why not append i to portfolio instead?


#3

The argument in a compound assignment must be matching in type…

portfolio += [i]

This will append the item to the list.