Problem Set 5; Problem 6 of 6
I rewrote this code so many times. I might have finished this problem earlier in the week, but I had to create most of the functions on my own. Please note that it wasn’t just creating the functions itself that was difficult, but mostly it was understanding what kinds of functions to create and how to organize them. I was only provided with two functions with which to make my game. This was the first time I attempted something this complicated without more help from the MIT course information provided. In order to better explain my organization and final code I’m going to split this game up into a couple of blog entries, specifically as there were several function mishaps I want to discuss in detail.
To create this game I separated it into four different functions. Three of those functions were supportive to the final function, which processed the game. In this post I’ll just talk about my first function, the play function.
def play(word): print word player = raw_input("Please enter a letter:") for p in player: if p in alpha: word = word + player return word |