Timeline for Simple Hangman game in Python
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 31, 2017 at 18:39 | comment | added | srattigan | Might just make it that little clearer for twoplayer = ("n", "y").index(twoplayer.lower()) to use twoplayer = bool(("n", "y").index(twoplayer.lower())) to make it explicit that the index will be a boolean value? Great work @zondo ! | |
Mar 13, 2016 at 22:06 | comment | added | zondo |
You can take out the for loop and put that in. I edited my answer to make that more clear and to add one more thing on that.
|
|
Mar 13, 2016 at 22:05 | history | edited | zondo | CC BY-SA 3.0 |
added 151 characters in body
|
Mar 13, 2016 at 22:02 | comment | added | vkumar | One more thing, could you please explain how I should use " ".join("_" * lengthword) | |
Mar 13, 2016 at 21:50 | comment | added | zondo |
twoplayer.lower() will be either "y" or "n" . If it is "y" , then ("n", "y").index(twoplayer.lower()) will be 1. If it is "n" , then it will be 0. Since 1 has a boolean value of True and 0 has a boolean value of False , twoplayer can now be used as a boolean.
|
|
Mar 13, 2016 at 21:48 | comment | added | vkumar | Thanks for the input, I understand everything except the part where you say use twoplayer = ("n", "y").index(twoplayer.lower()). Could you explain this a little bit more. | |
Mar 13, 2016 at 21:47 | vote | accept | vkumar | ||
Mar 13, 2016 at 21:29 | history | answered | zondo | CC BY-SA 3.0 |