-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcust_if_script2.py
More file actions
executable file
·43 lines (28 loc) · 1.14 KB
/
cust_if_script2.py
File metadata and controls
executable file
·43 lines (28 loc) · 1.14 KB
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
#!/usr/bin/env python3
"""Alta3 Research | Dana Kaempen
."""
message = "You chose this type of color:"
colors = { 'red': 'warm', 'orange': 'warm', 'yellow': 'warm', 'green': 'middle', 'blue': 'cool', 'black': 'cool' }
# show colors
print(colors.keys())
# ask the user to define "colorchoice"
colorchoice = input("Which color do you want? ")
# doing a lookup on what was chosen in one of the keys... does it match??
# because we want to make a choice of what our response should look like
#### SINGLE LINE SOLUTION
message = f"""{message} {colors.get(colorchoice, "I'm sorry, that color is non-existent")}"""
#### SECOND SOLUTION
#if colorchoice in colors.keys(): # if the color is in the dict
# message = f"{message} {colors[colorchoice]}"
#else:
# message = f"{colorchoice} is non-existent"
#### THIRD SOLUTION
#if colorchoice == 'red' or colorchoice == 'orange' or colorchoice == 'yellow':
# message = message + 'warm'
#elif colorchoice == 'blue' or colorchoice == 'black':
# message = message + 'cool'
#elif colorchoice == 'green':
# message = message + 'middle'
#else:
# message = message + 'non-existent'
print(message)