16.6k views
4 votes
Write a program that utilizes the concept of conditional execution, takes a string as input, and: prints the sentence "Yes - Spathiphyllum is the best plant ever!" to the screen if the inputted string is "Spathiphyllum" (upper-case) prints "No, I want a big Spathiphyllum!" if the inputted string is "spathiphyllum" (lower-case) prints "Spathiphyllum! Not [input]!" otherwise. Note: [input] is the string taken as input.

User Husman
by
3.7k points

1 Answer

5 votes

Answer:

Written in Python

inputt = input()

if inputt == "SPATHIPHYLLUM":

print("Yes - Spathiphyllum is the best plant ever!")

elif inputt == "spathiphyllum":

print("No, I want a big Spathiphyllum!")

else:

print("Spathiphyllum! Not"+ inputt+"!")

Step-by-step explanation:

This line gets user input

inputt = input()

This line checks if input is uppercase SPATHIPHYLLUM and executes the corresponding print statement, if true

if inputt == "SPATHIPHYLLUM":

print("Yes - Spathiphyllum is the best plant ever!")

This line checks if input is uppercase spathiphyllum and executes the corresponding print statement, if true

elif inputt == "spathiphyllum":

print("No, I want a big Spathiphyllum!")

If user input is not upper or lower case of Spathiphyllum, the following if condition is considered

else:

print("Spathiphyllum! Not"+ inputt+"!")

User Sujatha Girijala
by
4.7k points