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
Why does the ocean heat and cool more slowly than the atmosphere?
r-ruslan [8.4K]

The correct answer is letter A

Explanation: The higher temperature of the earth warms the air above it, making the atmospheric pressure lower than the ocean and blowing the wind to the earth. At night, the situation is reversed: the sea takes time to cool because the deep waters keep the nighttime temperature almost equal to the daytime

4 0
3 years ago
4. is the lowest price for a good or service always the best answers?
zaharov [31]
No as the quality of a good or service is sometimes influenced by the price and therefore cheaper items/services may be of lower quality. they could be faulty and break quickly and therefore you will end up wasting money in the long run as you will have to replace the item whereas it would have been cheaper to just invest in a better quality more expensive good or service in the first place. hope that helps!
5 0
3 years ago
Read 2 more answers
1 _________ had to work for a set number of years to pay off their passages to the colonies.
erastova [34]

Answer:

1.  indentured servant

2. Gorevnor Berkley accused Nathaniel Bacon of being a rebel.  

7 0
3 years ago
Read 2 more answers
Why are educated citizens crucial to the success of a democratic republic?
Alisiya [41]

Answer:

b !

Explanation:

a democratic republic is the "government of the people" and if said people are not informed then they won't know who to vote for or why and the country eventually will break into shamble/completely collapse and be unfixable

3 0
3 years ago
What civiliaztion is know for the nile river
Ede4ka [16]

Egyptian civilization

6 0
3 years ago
Read 2 more answers
Other questions:
  • Soft drinks cost $1.89 and refills cost $0.25 each. With $3.80 to spend on the soft drink and refills, what is the maximum numbe
    11·2 answers
  • When did nine eleven ended?
    12·1 answer
  • In 1933, the Nazi government used the Hereditary Health Court to __________. A. start a government eugenics program B. end the g
    7·2 answers
  • During the Antebellum period, religion was used by many Americans to
    10·2 answers
  • How might the distribution of Philip's empire have made it difficult to administer?
    10·1 answer
  • Which of the following statements about Chinese silk is false? Silk was in high demand as a trade good. Silk was made from the c
    7·1 answer
  • The most heavily occupied part of the maya region during the classic period was
    14·2 answers
  • (PLZ HELP ASAP)
    8·2 answers
  • What effect of the French and Indian War led indirectly to the American Revolution?
    13·1 answer
  • -What are the main causes of WWI? Be sure to include an example to represent each cause.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!