Python question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Python question

How to check if a string have two words or more?Valid english words.

4th Sep 2020, 5:12 PM
HBhZ_C
HBhZ_C - avatar
5 Answers
+ 12
HBhZ_C , what you can do is: (1) split the input string to individual words. This will create a list (2) check the length of the list using len().The number that results is the number of words in input. What do you mean by saying "valid english words"? If you want to check if the words real exists, this is additional effort. Then you will need a corpus file with all words used in english language.
4th Sep 2020, 5:16 PM
Lothar
Lothar - avatar
+ 7
HBhZ_C , before you can expect to get help here, you should have done a try by yourself first, and post it here. Thanks!
4th Sep 2020, 5:31 PM
Lothar
Lothar - avatar
+ 2
Maybe Namit Jain bro can help you 😄😊
4th Sep 2020, 5:15 PM
CliX [Less Active ❌]
CliX [Less Active ❌] - avatar
+ 2
Jan Markus, i am confused, because i thought NLTK means "Natural Language Toolkit"? Is there an other one with the same abbreviation?
5th Sep 2020, 12:01 PM
Lothar
Lothar - avatar
+ 1
No Jan Markus it is the password validator code ;i have try but no good results.
4th Sep 2020, 7:06 PM
HBhZ_C
HBhZ_C - avatar