'''
function 'text_strip_split(text)' delete special symbolsand
whitespace in start and end string,after we enter number of word ,
that it should write , and finally write this word.
'''
def text_strip_split(text):
list = [ '!' , ',' , '.' , '?' , ':' , '/' , '*' , '#' , '%' , '\\' , '_' , '-' , '=' , '+' , '&' ,';']
for i in list:
text = text.replace( i , ' ').strip()
text = text.split()
print()
while True:
x = int(input('Enter number word that i should print on console:\n')) - 1
if x > len(list) or x < 0:
print('Enter other number!')
else:
break
print(text[x])
word = input('Write the something text with special symbols: \n')
print(text_strip_split(word))
Asked
Active
Viewed 79 times
-2

chepner
- 497,756
- 71
- 530
- 681

Aleksei Grabor
- 153
- 2
- 8
-
1Because there's no `return` statement. – Larry Lustig Jul 20 '18 at 13:23
-
Please ,tell my how you can simplify or combine my 'list' ? – Aleksei Grabor Jul 20 '18 at 13:23
-
@chepner I appreciate that you deleted your answer when you closed, lots out there that don't – Nick is tired Jul 20 '18 at 13:25
-
Your `text_strip_split` function doesn't return a value. – vielkind Jul 20 '18 at 13:25
1 Answers
1
You have no return statement in the function.

RomaValcer
- 2,786
- 4
- 19
- 29
-
Can we help me? How you can combine or simplify my list with special symbols? May be Python have got a something function or module with them? – Aleksei Grabor Jul 20 '18 at 13:40
-
@AlekseiGrabor you may want to look at string.punctuation. It contains all the ASCII punctuation symbols. – RomaValcer Jul 20 '18 at 13:53