Posted by King_Critter on Sat 14th Nov 09:51
download | new post | report as spam

  1. #! /usr/bin/env python                             
  2.  
  3. import random
  4.  
  5. print "Welcome to this awesome hand of blackjack!"
  6. print "Place your bets and get on with it!"       
  7.  
  8. #cash = 100
  9.  
  10. #placebet = input("Place yer bet!)"
  11.  
  12. #dealer goes
  13. card1 = random.randint(1,10)
  14. card2 = random.randint(1,10)
  15. aitotal = card1 + card2
  16.  
  17. #player goes
  18. card1 = random.randint(1,10)
  19. card2 = random.randint(1,10)
  20. total = card1 + card2
  21.  
  22. switch = 1
  23. while switch == 1:
  24.         print total
  25.         choice = raw_input("Hit or pass? ")
  26.         if choice == "hit":
  27.                 newcard = random.randint(1,10)
  28.                 total += newcard
  29.         elif choice == "pass":
  30.                 switch = 0
  31.                 print "Passed."
  32.         else:
  33.                 print "Unknown command, please don't mind the 8-legged furry critter on your shoulder.\nLeft shoulder, that is."

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily
.
Syntax highlighting:

To highlight particular lines, prefix each line with @@
   Remember me