Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
8 views1 page

12

The document provides a Python program that counts the occurrences of the word 'is' in a user-inputted sentence. It converts the sentence to lowercase, splits it into words, and uses the count method to find the frequency of 'is'. The output displays the number of times 'is' appears in the sentence.

Uploaded by

Ajay Yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

12

The document provides a Python program that counts the occurrences of the word 'is' in a user-inputted sentence. It converts the sentence to lowercase, splits it into words, and uses the count method to find the frequency of 'is'. The output displays the number of times 'is' appears in the sentence.

Uploaded by

Ajay Yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

12) Write a program to enter the sentence from the user and print how many time the

word ‘is’
appear in the sentence.

sentence = input("Enter a sentence: ")

sentence = sentence.lower()

words = sentence.split()

count_is = words.count('is')

print(f"The word 'is' appears {count_is} time(s) in the sentence.")

Output

Enter a sentence: is their anyone who is not having the invitation

The word 'is' appears 2 time(s) in the sentence.

You might also like