Here is the code then:
#This is code for a blackjack game.
import random
cash = 0 new_cash = 100 cards = {"Ace", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"} card_types = {"Diamond", "Heart", "Spade", "Club"} bet = 0 playertotal = 0 comp_total = 0 def menu():
print "1. Bet and play." print "2. Cash out and Exit" def option():
return int(raw_input("Menu choice: ")) def card_choice():
return random.choice(range(1,14) def types():
return random.choice(range(1,5) def player_cards():
print a," of ",t1 print b," of ",t2 print "Blackjack"
print "By Nathan Pinno" while 1: menu() choice = option() if choice == 1: bet = int(raw_input("How much do you want to bet: ") while 1: if bet > new_cash: print "Sorry, you don't have that much cash! Your total cash is: $",new_cash else: break a,b = card_choice() t1,t2 = types() if t1 == 1: t1 = card_types[0] elif t1 == 2: t1 = cardtypes[1] elif t1 == 3: t1 = cardtypes[2] else: t1 = cardtypes[3] if a == 1: a = cards[0] playertotal = playertotal + 1 elif a == 2: a = cards[1] playertotal = playertotal + 2 Now do you have an idea of what I'm pointing to?
|
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor