Hello everyone. This is my first post so if something doesn't work, bear with me. I'm a beginner at python and tried to write a program that will calculate Average Word Length. I wrote what I thought should work but the final answer keeps coming out to an average of one no matter what I write. Help someone?
def main(): print"This program will calculate average word length!" import string s = raw_input ("Enter a phrase: ") words = s.split() wordCount = len(words) for word in words: ch= len(word) avg = ch / wordCount if avg is 1: print "In the sentence", s , ", the average word length is", avg, "letter." else: print "In the sentence", s , ", the average word length is", avg, "letters." main()