\' \' in word == True
I\'m writing a program that checks whether the string is a single word. Why doesn\'t this work and is there any better way to che
Write if " " in word:
instead of if " " in word == True:
.
Explanation:
a < b < c
is equivalent to (a < b) and (b < c)
.in
!' ' in w == True
is equivalent to (' ' in w) and (w == True)
which is not what you want.