title: Python bugs or errors
body: <p>I am a beginner in Python and I have written this simple code but there are some errors that I could not resolve :( </p>
  
  <p>Please can someone help me ?</p>
  
  <pre><code>//initialization
  str = None
  var = None
  
  def setvar(val):
  """ Sets the global variable "var" to the value in 'val' """
  if val:
   print "setting variable 'var' to '$val'"  // we want to print the value of 'val'
  else:
   print "un-setting variable 'var'"
  
   var = val
   return
  
  if __name__ == 'main':
    try:
      setvar("  hello world!  ") // use this function to set the 'var' variable
      var.strip() // we want the leading and trailing spaces removed
      print str(var)
    except:
      print "something went wrong"
  </code></pre>