title: List comprehension vs set comprehension
body: <p>I have the following program. I am trying to understand list comprehension and set comprehension:</p>
  
  <pre><code>mylist = [i for i in range(1,10)]
  print(mylist)
  
  clist = []
  
  for i in mylist:
      if i % 2 == 0:
          clist.append(i)
  
  
  clist2 = [x for x in mylist if (x%2 == 0)]
  
  print('clist {} clist2 {}'.format(clist,clist2))
  
  #set comprehension
  word_list = ['apple','banana','mango','cucumber','doll']
  myset = set()
  for word in word_list:
      myset.add(word[0])
  
  myset2 = {word[0] for word in word_list}
  
  print('myset {} myset2 {}'.format(myset,myset2))
  </code></pre>
  
  <p>My question is why the <strong>curly braces</strong> for <code>myset2 = {word[0] for word in word_list}</code>.</p>
  
  <p>I haven't come across <strong>set</strong>s in detail before.</p>