Did I fuck up in any major way?
Improvements, not fuckups:
1) maybe you didn't notice, maybe you intended it that way, but the house has a slight advantage (on a roll 1-100, the player wins at 52 or more); in other words it's RIGGED.
2) the win chance should be a module-level variable: just put
Python:
WIN_CHANCE = 49 # percent
if you want to keep it slightly RIGGED, (or 50 for a fair game), at the top level (meaning outside functions, no offset) in your code, and test for
Why a variable? Because it is a parameter, not a physically immutable constant (e.g. the number of dimensions in a 2D image), and you might want to check it or change it, and it's hard to search the code for a number. Sometimes you might want to reuse a parameter and/or change it, and then you'd have to search for a number and for each found instance, determine if it's the win chance or the average number of seshes before the cops arrive to arrest the player on two outstanding warrants. Searching for a name is easier. For a short program and "local" parameters, keep them at the top level in a respective file. For a long program spanning several files, the common parameters are better moved to a dedicated file and imported from there (you can
import from your own code, too, not just from someone else's).
Why less than or equal? Because that way you get to explicitly define the win chance of the player, which is what people are most interested in, and this makes for the most simple conditional expression.
Also you might want to print out the game roll, because it's fun for the player to see "by how much" he lost.
What else to do:
1. maybe you think rolling higher should be better, like you originally had it. Now that you're printing out the game roll, it may be confusing for the player to win at 20 and lose at 100. So rewrite the condition, using math, to both use
WIN_CHANCE = 49 and to have higher=better.
2. if you keep it RIGGED, eventually the player will notice he's losing on a 50 (or 51 if higher=better). Try to RIG the game in a way that's less obvious to the player.
And do the name guard thing Agent Snigger wrote about, it's important/obligatory. Always always always use it, even for very simple programs.