Created
April 7, 2021 19:59
-
-
Save Corteil/fb1369af3c372617484566262af43561 to your computer and use it in GitHub Desktop.
Dictionary example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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