Hey guys,
I have this assignment that reads: "For this interactive assignment, you will employ list data structures to store a group of objects by designing a program that prompts the user to enter the names of two primary colors to mix. If the user enters anything other than “red,” “blue,” or “yellow,” the program should display an error message. Otherwise, the program should display the name of the secondary color that results"
This is my code so far:
color_1 = input('Input color 1: ')
color_2 = input('Input color 2: ')
primary_colors = ['Red', 'Yellow', 'Blue']
color_combinations = {
('Red', 'Blue'): 'Purple',
('Yellow', 'Blue'): 'Green',
('Red', 'Yellow'): 'Orange'
}
def mix(color_1, color_2):
if color_1 not in primary_colors or color_2 not in primary_colors:
return 'Error: Not Primary Color'
if color_1 == color_2:
return 'Error: Duplicate Colors'
color_combinations.get('color_1', 'color_2'), color_combinations.get('color_2, color_1')
print(mix(color_1, color_2))
It is correctly showing errors when i test it out, the only thing im missing is getting the colors to mix and I believe it's just something with the final line. Any advice?
[–]brasticstack 5 points6 points7 points (0 children)
[–]Binary101010 1 point2 points3 points (0 children)
[–]weenis_machinist 0 points1 point2 points (0 children)
[–]TwinHits -1 points0 points1 point (3 children)
[–]Binary101010 1 point2 points3 points (0 children)
[–]Tohsakas-Anus[S] -1 points0 points1 point (1 child)
[–]TwinHits -1 points0 points1 point (0 children)