title: How to Write a Python program to find smallest and largest word in a given string?
body: <p>I am trying to find the <strong>largest</strong> and <strong>smallest</strong> word in a given <strong>string</strong>. </p>
  
  <p>This is my target string.</p>
  
  <blockquote>
    <blockquote>
      <p>'Hello, welcome to python programming '</p>
    </blockquote>
  </blockquote>
  
  <p>I have extracted the words in the string and their lengths into  key value pairs in a dictionary. Below is the code i wrote.</p>
  
  <pre><code>Line='Hello, welcome to python programming '
  
  words=[x for x in Line.split()]
  print(words)
  
  lengths=[len(word) for word in words]
  print(lengths)
  
  x = {words[i]: lengths[i] for i in range(len(words))} 
  print('--'*44)
  print (x)    
  </code></pre>
  
  <p>I am getting the resulted dictionary as below</p>
  
  <pre><code>['Hello,', 'welcome', 'to', 'python', 'programming']
  [6, 7, 2, 6, 11]
  *************************************************************************
  {'Hello,': 6, 'welcome': 7, 'to': 2, 'python': 6, 'programming': 11}
  </code></pre>
  
  <p>I want to <strong>sort</strong> the dictionary and <strong>print the keys</strong> which have the <strong>highest</strong> and <strong>lowest</strong> values i.e the words which are <strong>longest</strong> and <strong>shortest</strong>.</p>