Last active
September 18, 2015 12:30
-
-
Save z-------------/e241d8d3fa14a1540262 to your computer and use it in GitHub Desktop.
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
| def gourdify(text): # start defining a function | |
| words = text.split(" ") # split the text at each space | |
| for i in range(0, len(words)): # for each i between 0 and the number of words | |
| if words[i][0] is "G": # if the first letter of current word is "G" | |
| words[i] = "Gourd" # set the whole word to "Gourd" | |
| elif words[i][0] is "g": # if the first letter of current word is "g" | |
| words[i] = "gourd" # set the whole word to "gourd" | |
| return " ".join(words) # join the list of words with a space between each word | |
| print(gourdify("Hello! I am feeling good")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment