Last active
August 29, 2015 14:01
-
-
Save gregz67/00bf29d9611b3298c361 to your computer and use it in GitHub Desktop.
Programming Club dictionary challenge
This file contains hidden or 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
| __author__ = 'gregz' | |
| # 1. Create a dictionary of three or more of your Minecraft friends. | |
| # The key should be their first name, the value should be their Minecraft login. | |
| # 2. Input a friends name. | |
| # * if the name is in the dictionary, print their Minecraft login. | |
| # * if the name is not in the dictionary | |
| # * print a message saying that name is not in the dictionary | |
| # * input their Minecraft login | |
| # * add it to the dictionary. | |
| minecraft = { | |
| 'Greg': 'ZebClan', | |
| 'Josh': 'Joe5$9', | |
| 'Alex': 'ChezzyBiscuit' | |
| } | |
| name = input('Enter a name: ').capitalize() | |
| if name in minecraft: | |
| print(name + '\'s Minecraft login is: ' + minecraft[name]) | |
| else: | |
| print(name + ' is not in my Minecraft dictionary.') | |
| minecraft[name] = input('What is ' + name + '\'s Minecraft login?: ') | |
| print(minecraft) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment