1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vlada [557]
2 years ago
6

Write a program that reads a one-line sentence as input and then displays the following response: If the sentence ends with a qu

estion mark and the input contains an even number of characters, display the word Yes. IF the sentence ends with a question mark and the input contains an odd amount of characters, display the word No. If the sentence ends with an exclamation point, display the word Wow. In all other cases display the words You always say followed by the input string enclosed in quotes
History
1 answer:
Nastasia [14]2 years ago
5 0

The program is an illustration of conditional statements

<h3>What are conditional statements?</h3>

Conditional statements are statements used to make decisions

<h3>The main program</h3>

The program written in Python, where comments are used to explain each action is as follows:

#This gets the input for the sentence

sentence = input("Word: ")

#This counts the number of characters

countChar = len(sentence)

#The following if conditions print the required output from the test conditions

if(sentence[-1] == "?" and countChar%2 == 0):

   print("Yes")

elif(sentence[-1] == "?" and countChar%2 == 1):

   print("No")

elif(sentence[-1] == "!"):

   print("Wow")

else:

   print("Nice",sentence)

Read more about conditional statements at:

brainly.com/question/24833629

You might be interested in
The main argument in the excerpt above from the first petition of the Chartists is:
NeTakaya

Answer:

C) since the laborers do all of the work, they should earn all of the profits.

Explanation:

The main argument in the excerpt above from the first petition of the Chartists is since the laborers do all of the work, they should earn all of the profits.

7 0
3 years ago
Read 2 more answers
Complete this sentence: Democrats tend to be more _________________, while Republicans tend to be more __________________.
babymother [125]
Democrats are liberal and Republicans are Conservative. Hope this helps :)
8 0
3 years ago
Read 2 more answers
In the sixth century, Rome became a(n)<br> state.<br> democracy.<br> O republic.<br> O empire.
maks197457 [2]

Answer: rome became a republic.

7 0
2 years ago
What was the result of the US participating in World War 1
Oduvanchick [21]

Answer:

When the war concluded in November 1918, with a victory for the Allies, more than 2 million U.S. troops had served at the Western Front in Europe, and more than 50,000 of them died.

Explanation:

8 0
3 years ago
Read 2 more answers
What role does the chinese communist party play in the giverment of china?
Nesterboy [21]
All it does is try to take over china
4 0
3 years ago
Other questions:
  • How did medieval and the feudal system break down?
    11·1 answer
  • The goal of the pendleton act and the hatch act was to:
    11·1 answer
  • PLEASE HELP WITH THIS QUESTION
    13·1 answer
  • Who was the first president of japan​
    7·2 answers
  • What is the significance of the phrase 54 40 or fight
    5·1 answer
  • What was Alexander Hamilton's leadership style like, and how did he express it through what he did?
    8·2 answers
  • Which of the following was NOT a precedent set by President George Washington?
    9·1 answer
  • What state attempted to nullify their tax laws?
    10·2 answers
  • ¿Por qué los Gobiernos españoles se aferraban a Cuba?
    6·1 answer
  • How did Western Europe lead the Industrial Revolution?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!