title: Python - Remove whitespaces and punctuation without functions
body: <p>first of all, sorry for my bad english. I'm a beginner programmer and I have some problems with my python program.
  I have to make a program that normalizes the whitespaces and the punctuation, for example:</p>
  
  <p>If I put a string called </p>
  
  <pre><code>"   hello   how,   are  u?   "
  </code></pre>
  
  <p>The new string has to be...</p>
  
  <pre><code>"Hello how are u"
  </code></pre>
  
  <p>But in my code, the result appears like this and I dont know why:</p>
  
  <pre><code> "helloo how,, aree u??"
  </code></pre>
  
  <p><strong>Note:</strong> I can't use any kind of function like split(), strip(), etc...</p>
  
  <p>Here is my code:</p>
  
  <pre><code>from string import punctuation
  
  print("Introduce your string: ")
  string = input() + " "
  word = ""
  new_word = ""
  final_string = ""
  
  #This is the main code for the program
  for i in range(0, len(string)):
      if (string[i] != " " and (string[i+1] != " " or string[i+1] != punctuation)):
          word += string[i]
      if (string[i] != " " and (string[i+1] == " " or string[i+1] == punctuation)):
          word += string[i] + " "
          new_word += word
          word = ""
  
  #This destroys the last whitespace
  for j in range(0,len(new_word)-1):
      final_string += new_word[j]
  
  print(final_string)
  </code></pre>
  
  <p>Thank you all.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Now i have this code:</p>
  
  <pre><code>letter = False
  
  for element in my_string:
      if (element != " " and element != punctuation):
          letter= True
          word += element
  
  
  print(word)
  </code></pre>
  
  <p>But now, the problem is that my program doesn't recognize the punctuation so if i put:</p>
  
  <pre><code>"Hello   ... how  are u?"
  </code></pre>
  
  <p>It has to be like <code>"Hellohowareu"</code></p>
  
  <p>But it is like:</p>
  
  <pre><code>"Hello...howareu?
  </code></pre>