Question: Part B:Write a program that will read in one line of text, a sentence, as input, and then display the following: if the sentence ends

Part B:Write a program that will read in one line of text, a sentence, as input, and then display the following:

if the sentence ends in a ?, and has an even number of characters, print "Yes"

if the sentence ends in a ? and has an odd number of characters, print "No"

if the sentence ends in a !, print "Wow"

In all other cases, write "You always say", followed by what they said, in " "

Sample Output (4 different runs)

Sentence: I dream of electric sheep

You always say"I dream of electric sheep"

Sentence: Am I right?

No

Sentence: Am I rright?

Yes

Sentence: Say hey!

Wow

Bold is user input.

Thanks so much for your help!!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!