Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import string
- 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']
- h = 0
- for h in range(len(hi)):
- if list[h] in string.whitespace:
- if list[h + 1] in string.punctuation:
- list.pop(h)
- h = h + 1
- else:
- h = h + 1
- else:
- h = h + 1
- print(list)
- File " ... ", line 110, in <module>
- if list[h] in string.whitespace:
- IndexError: list index out of range
Add Comment
Please, Sign In to add comment