0

Average word length

Please tell how to remove symbols from the sentence x = str(input()) txt = len(x.strip()) word = len(x.split()) print(round(txt//word))

6th Aug 2022, 1:22 PM
Abharna K
Abharna K - avatar
1 ответ
+ 1
Many ways.. Simple one, Hint: isalpha() returns true if str is an alphabet otherwise false. Ex: str.isalpha() print('a'.isalpha() ) #True str.isalpnum() returns true if str is a alphabet or numeric value.. print('1'.isalnum()) #True also isdigit() used to check is it digit or not. isnum() used to check is it number or not. . Symbols are not alphabets, not numbers...
6th Aug 2022, 2:12 PM
Jayakrishna 🇮🇳