For problem set 2, I'm working on a hangman game. Right now, I'm trying to create a function that will report the user's progress in the game. This means for a word "hello" and guess "o" the function will return "____o". Here's what I have so far:http://pastebin.com/qQzeAE7F Thanks in advance
My second crack at it: http://pastebin.com/B2K69ZSy Feel very close, but Python won't let me do what I'm trying to do. Need to find another way.
what's the output? What does it return?
woooo hoooo!!! a moment of inspiration struck while I was watching a movie :) I've got the solution now, and damn it felt good to find it. http://pastebin.com/HWXsQ6ck @theandreim Sorry, you'd have to run it in IDLE. I've been debugging for so long I forget what those instances did exactly. But they were very far off.
if you need to iterate over the indices and items of a sequence, consider using the enumerate() function. If you just need to iterate over the items 'choose' them directly - http://dpaste.com/776984/ http://docs.python.org/tutorial/datastructures.html#looping-techniques http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html#use-in-where-possible-1
My final product if anyone has suggestions to streamline it or other comments to help me learn: http://pastebin.com/76mdMHPb For me, this code had a lot of different parts and was hard to hold it all in my head sometimes. To all you programmers out there, how the heck do you deal with actual software with thousands of lines of code? How do you start from scratch on something like that? Boggles my mind.
Join our real-time social learning platform and learn together with your friends!