-
Notifications
You must be signed in to change notification settings - Fork 3
/
3.1.1.10Lab.py
57 lines (39 loc) · 1.73 KB
/
3.1.1.10Lab.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
'''
Estimated time
5-15 minutes
Level of difficulty
Easy
Objectives
becoming familiar with the the input() function;
becoming familiar with comparison operators in Python;
becoming familiar with the concept of conditional execution.
Scenario
Spathiphyllum, more commonly known as a peace lily or white sail plant, is one of the
most popular indoor houseplants that filters out harmful toxins from the air. Some
of the toxins that it neutralizes include benzene, formaldehyde, and ammonia.
Imagine that your computer program loves these plants. Whenever it receives an input in
the form of the word Spathiphyllum, it involuntarily shouts to the console the following
string: "Spathiphyllum is the best plant ever!"
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.
Test your code using the data we've provided for you. And get yourself a Spathiphyllum, too!
Test Data
Sample input: spathiphyllum
Expected output: No, I want a big Spathiphyllum!
Sample input: pelargonium
Expected output: Spathiphyllum! Not pelargonium!
Sample input: Spathiphyllum
Expected output: Yes - Spathiphyllum is the best plant ever!
'''
# solution
plant = input("Input a plant name: ")
if plant == "Spathiphyllum":
print("Yes - Spathiphyllum is the best plant ever!")
elif plant == "spathiphyllum":
print("No, I want a big Spathiphyllum!")
else:
print("Spathiphyllum! Not " + plant + "!")