I wanted to create simple games using Python scripting that would act as a simple intro to the language
Using an online compiler, I first created a series of variables that would be used and called upon throughout the game. The variables are defined through "def". These variables would keep track of money earned and bet on, whether the player wants to continue, the player's name, and whether or not the game is over.
From the "while keep_playing:", the "if" statement checks if the user has money, "elif" to check if the bet is either less than or equal to 0, like a negative number, or if its more than what the player has making it invalid, and "else" to let the player know that it's valid if the user has the money.
Through the "random.randint", which stands for random integer, we assign the numbers to be 1 through 12, which will allow the game to pull a random number between those for both the player and the computer.
At the end of the code, "gamebody()" must be entered to get the game to run.
Using the "if" and "elif" statements will help determine whether the card is greater than, less than, or equal to the card the computer has. If mine is greater, I earn however much I bet; if I lose, then I lose what I bet, and if it's a tie, then I don't earn or lose anything.
The "else" at the end gives the player the option to tell the computer whether they wish to continue playing or stop early.