Guest User

Untitled

a guest
Nov 19th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. import string
  2.  
  3. list = ['H', 'i', 's', 't', 'a', 'y', ' ', 's', 'i', 'a', 'y', ' ', 'a', 'a', 'y', ' ', 'e', 's', 't', 't', 'a', 'y', ' ', '.', ' ', 'H', 'i', 's', 't', 'a', 'y', ' ', 's', 'i', 'a', 'y', ' ', 'a', 'a', 'y', ' ', 'e', 's', 't', 't', 'a', 'y']
  4.  
  5. h = 0
  6.  
  7. for h in range(len(hi)):
  8. if list[h] in string.whitespace:
  9. if list[h + 1] in string.punctuation:
  10. list.pop(h)
  11. h = h + 1
  12. else:
  13. h = h + 1
  14. else:
  15. h = h + 1
  16.  
  17. print(list)
  18.  
  19. File " ... ", line 110, in <module>
  20. if list[h] in string.whitespace:
  21. IndexError: list index out of range
Add Comment
Please, Sign In to add comment