I have another string dilemma. I am asked to write a program that counts the number of words in a sentence entered by the user. This is what I have right now, although I don't think that it is anywhere near being correct:
import string
def main():
print "This program calculates the number of words in a sentence"
print
p = raw_input("Enter a sentence: ")
words = string.split(p)
wordCount = string.count(words, p)
print "The total word count is:", wordCount
main()
I'm pretty sure that the string.count() is all wrong but I don't understand what I'm supposed to put in the parentheses. Assistance would be greatly appreciated. Thank you.