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
Solve: XIV – VI. Show your answer as a Roman Numeral.
Law Incorporation [45]

Answer:

D. VIII

Explanation:

XIV = 14

VI = 6

14 - 6 = 8 = VIII

3 0
2 years ago
From the 1850s to the 1890s, the main form of urban mass transportation in the united states was the
charle [14.2K]
<span>Numbers of vehicles on road increases tremendously. </span>
8 0
3 years ago
Which of the following was a significant result of the Albany Congress?
alukav5142 [94]
C, Benjamin Franklin proposed a new constitution for the colonies
7 0
2 years ago
How did the mexican-american war lead to greater sectionalism within the united states government?
gogolik [260]

There was great tension between pro-slavery and anti-slavery representatives over how new territories won would handle the issue of slavery.

The Mexican-American War and the 1848 Treaty of Guadalupe Hidalgo, forced onto the remnant Mexican government,  drew some criticism in the U.S. for their casualties, monetary cost, and heavy-handedness. Furthermore, the question of how to treat the new acquisitions also intensified the debate over slavery and in many ways inflamed it, as potential westward expansion of the institution took an increasingly central and heated theme in national debates preceding the American Civil War.

8 0
3 years ago
Read 2 more answers
What three states are home to the Ozark Mountains?
Ilia_Sergeevich [38]

Answer:

A  Missouri, Arkansas, and Kansas

5 0
3 years ago
Read 2 more answers
Other questions:
  • Que significa etnocentrismo
    6·1 answer
  • Experience on the Underground Railroad helped ______ with her work as a Union spy. a. Clara Barton c. Harriet Tubman b. Belle Bo
    12·1 answer
  • How did Hobbes view the church’s relationship to government
    14·1 answer
  • Which of the following is not a priest
    8·1 answer
  • 38. Which of the following would most likely end in a civil case
    14·1 answer
  • How did conflicts between France and Britain affect John Adams presidency?
    13·1 answer
  • Which of the following governments is the most unrealistic for the people?
    13·1 answer
  • HELP ASAP
    15·1 answer
  • Can someone help me please
    5·1 answer
  • 1. At Jamestown, the London Company established what organization so settlers would
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!