This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## initiate game | |
print( | |
'\n' * 100 + | |
'#' * 16 + | |
'\n\nSIMPLE BLACKJACK' + | |
'\nby Craig Janis\n' + | |
'\nOverview: You start with two cards\nand decide whether to "hit" (ask\nfor another card) or "stand" (end\nyour turn with the cards you\nalready have). The dealer starts\nwith one card visible and one\ncard face down, and after your\nturn, the dealer will have a\nchance to hit or stand. You win\nif you end the game with more\npoints the dealer, but fewer\nthan 21 points. If you go over 21\npoints, that\'s called a "bust".\nTies go to the Dealer.\n\n' + | |
'#' * 16 | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b = ['O',' ',' ',' ',' ',' ',' ',' ',' ',' '] | |
def play(b,m=0): | |
# reset board if new game | |
if m == 0: | |
b = ['O',' ',' ',' ',' ',' ',' ',' ',' ',' '] | |
print('new game') | |
# update board |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# given principal and interest rate | |
# + periods = minimum payment amount and total cost | |
# + extra payment = periods, total cost, and savings over minimum | |
import math | |
def calculate(principal,rate_yearly,periods,extra=0): | |
# variables | |
rate_monthly = rate_yearly / 12 / 100 |
OlderNewer