Aluko Kenny

Generation

generate functionSun, 14 May 2023

Ask the user to copy and paste their text, count the amount of words in the text and print out results

def count_words(): user_text = input('Please copy and paste your text: ') user_text = user_text.split() count = 0 for word in user_text: count += 1 print('There are {} words in the text'.format(count)) count_words()

Questions about programming?Chat with your personal AI assistant