Oct-05-2018, 06:27 PM
First, file.read() returns a string. When you loop through a string (as in
Second, as the error you got shows, you want to test for
Third, you first if clause is not needed. If the second if clause doesn't trigger, the loop goes to the next iteration, which is all your first if clause is doing.
for counter in content:
), you loop through the characters of the string. You want to loop through the words in content, not the characters. So you need to use the split method as you did for sentence.Second, as the error you got shows, you want to test for
string in list
, not list in string
. So flip the variables around the in operator.Third, you first if clause is not needed. If the second if clause doesn't trigger, the loop goes to the next iteration, which is all your first if clause is doing.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures