Question: How to find sentences in text file that starts and ends with particular words for example sentences that starts with 'The' and ends with 'u'.I have tried

```
def main():
  f=open('D:\\file.txt')
  print 'The lines that starts with The and Ends with u'
  for line in f:
     for j in line.split('.'):
         if j[0]=='T' and j[1]=='h' and j[2]=='e' and j[3]==' ' and  j[-1]=='u':
            print j
if __name__ == '__main__':main()

```

Instead of character comparison can we do this using word comparison?

Answer: 
It is an alternative syntax for `set()`

```
>>> a = {1, 2}
>>> b = set()
>>> b.add(1)
>>> b.add(2)
>>> b
set([1, 2])
>>> a
set([1, 2])
>>> a == b
True
>>> type(a) == type(b)
True

```

`dict` syntax is different. It consists of key-value pairs. For example:

```
my_obj = {1:None, 2:None}

```
`set([iterable])` is the constructor to create a set from the optional iterable `iterable`. And `{}` is to create set / dict object literals. So what is created depends on how you use it. 

```
In [414]: x = {}

In [415]: type(x)
Out[415]: dict

In [416]: x = {1}

In [417]: type(x)
Out[417]: set

In [418]: x = {1: "hello"}

In [419]: type(x)
Out[419]: dict

```