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
How many Persians were at the battle of Thermopylae
Bess [88]

The pass at Thermopylae was thus opened to the Persian army, according to Herodotus, at the cost to the Persians of up to 20,000 fatalities.

7 0
2 years ago
Read 2 more answers
American encounters art history and cultural identity free
mr_godi [17]
American Encounters<span>, as a whole, stands as a major achievement and promises to enrich and enliven the study and teaching of American art and visual culture. I look forward to using it in my own courses, and I imagine that many of my colleagues, on reading it, will feel the same.

</span>
7 0
3 years ago
Which political system favors an economic structure in which the means of production are owned and monitored by the government?
Natasha_Volkova [10]
D. Capitalism because it is monitored by the government
7 0
2 years ago
With of these fair deal reforms did not happen
Lisa [10]

whaT? bgfd ghvhtvhtetrtrvhevhvtrh

5 0
3 years ago
Read 2 more answers
How do natural resources impact the economies of countries in Southern and Eastern Asia?
Pani-rosa [81]

Answer:

d

Explanation:

5 0
2 years ago
Read 2 more answers
Other questions:
  • Match the vocabulary word with its meaning.
    6·1 answer
  • As Chief Executive, a president must do which of the following? Select all that apply.
    8·1 answer
  • This was the first governing document of plymouth colony
    12·1 answer
  • What kind of culture changes do you think the great migration brought to the African American community
    9·1 answer
  • What was the date of the Birmingham Protests when did it start and end?
    15·1 answer
  • The implied protection of a right under the coverage of a more broad constitutional protection is said to
    6·1 answer
  • John Lewis what does he do in his legislative branch
    7·1 answer
  • Bleeding Kansas occurred when people tried to flood into Kansas upon hearing that popular sovereignty would determine if it woul
    7·1 answer
  • Which is the best example of a concrete word?
    14·1 answer
  • A consequence of Germany promising Austria a "blank check" was that:________.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!