Ok so this question may sound kind of stupid but i'm working on a habit tracker project (non gui oriented for now) and was wondering is there a way to strip " " from a string so the remaining text is recognized as a constant?
The api I am using requires a user to choose a color for the graph however it recognizes the color in japanese(romanji) so I need it to take the input:
select_color = input("pick one of the following colors for the pixelation graph"
"\nGREEN, RED, YELLOW, BLUE, PURPLE, BLACK: ").upper()
color_choice = select_color
Then feed it into this if statement for user feedback:
choices = ["GREEN", "RED", "YELLOW", "BLUE", "PURPLE", "BLACK"]
for choice in choices:
if choice == color_choice:
COLOR = color_choice
else:
print("Invalid Color")
And what I want it to do is then select from the constants which color COLOR will be:
GREEN = "shibafu"
RED = "momiji"
YELLOW = "ichou"
BLUE = "sora"
PURPLE = "ajisai"
BLACK = "kuro"
COLOR = ""
print(COLOR)
In practice I want the print(COLOR) to return the contained value of one of the CONSTANTS
But in reality it's returning "RED" or "Green"
Which brings me to the original question is it possible to strip the "" from the data to make it read the constant variable
EG:
COLOR = RED -> COLOR = "momiji"
instead of
COLOR = "RED"
And yes I have figured I could just ask the user to input the Japanese characters but I figured it would be better to use the English color names.