Last active
October 5, 2016 19:27
-
-
Save MrDMurray/cfb641074fd09c228483dd536e63573d to your computer and use it in GitHub Desktop.
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
# this piece of code prints out characters and makes the list of words into uppercase | |
#The list as it is normally | |
inventory = ["pickaxe", "sword", "diamonds"] | |
print(inventory) | |
#Method 1: Using .upper each time | |
inventory = ["pickaxe".upper(), "sword".upper(), "diamonds".upper()] | |
print(inventory) | |
#OUTPUT LOOKS LIKE THIS: ['PICKAXE', 'SWORD', 'DIAMONDS'] | |
#Method 2: Using a for Loop | |
inventory = ["pickaxe", "sword", "diamonds"] | |
for x in inventory: | |
x=x.upper() | |
print(x) | |
""" | |
OUTPUT LOOKS LIKE THIS: | |
PICKAXE | |
SWORD | |
DIAMONDS | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment