Generation

generate functionTue, 13 Aug 2024

Write a program that will take input from user, a sentence and find the number of words available in that sentence

def count_words(sentence): words = 0 for word in sentence.split(): if word not in stopwords: words += 1 return words def main(): # read the file with open('./input.txt') as f: sentences = f.read().splitlines() # count the words total_words

Questions about programming?Chat with your personal AI assistant