Skip to content

Instantly share code, notes, and snippets.

@Corteil
Created April 7, 2021 19:59
Show Gist options
  • Save Corteil/fb1369af3c372617484566262af43561 to your computer and use it in GitHub Desktop.
Save Corteil/fb1369af3c372617484566262af43561 to your computer and use it in GitHub Desktop.
Dictionary example
colours = {'red': (254, 0, 0), 'green': (0, 254, 0), 'blue': (0, 0, 254), 'black': (0, 0, 0) }
# functions
def displayColour(colour):
global colours
print(f"{colour}'s RGB Value is { colours[colour] }")
# Main
textColour = input('input colour choice: ')
# change text colour to lower case
textColour = textColour.lower()
if textColour in colours:
displayColour(textColour)
else:
print('Colour is not defined')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment