The word in is an operator in Python. It tests if its left argument is contained within its right hand argument. With strings (which both "0" and choice are), it does a substring check.
So, "0" in choice tests to see if the choice string contains one or more zeros. The same thing is done for "1". So, the test "0" in choice or "1" in choice tests if there is either a "0" or a "1" in the user's input.
That's a fairly silly test. It will reject inputs like "23" and attempt to convert nonsense like "foo0baz" to an integer (and fail with an exception).
A better test is str.isdigit, which tests if all the characters in a string are decimal digits (0-9):
if choice.isdigit():
how_much = int(choice)
else:
dead("Man, learn to type a number.")
This idiom, of testing inputs ahead of time, is known as "Look Before You Leap" (LBYL) in Python circles. It's very common in languages like C that don't have good exception handling.
An alternative approach is to simply try the conversion, and then catch any exception that is raised if the input was not valid:
try:
how_much = int(choice)
except ValueError: # user did not enter a valid integer
dead("Man, learn to type a number.")
This style of programming is known as "Easier to Ask Forgiveness than Permission" (EAFP) and is often more popular in Python programming than LBYL, as our exceptions are fast and easy to use.
Whether LBYL or EAFP is better in a given situation is a matter of judgement. Sometimes one style is clearly shorter or easier to understand than the other, but a lot of the time either one can work. Python programmers tend to prefer EAFP whenever it is not obviously worse then LBYL, but there's not a hard rule. It's important to know how to program with both idioms.
gold_roomhas a weird way of getting you to type a number. What are all the bugs in this way of doing it? Can you make it better than what I've written? Look at howint()works for clues."