Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- credits = 500
- enter = input("Hello! I am the dealer for this game of BlackJack! Press enter to continue!")
- f = open("cards.txt","r")
- lines = f.readlines()
- cardarray = []
- for line in lines:
- cardarray.append(line.strip().split(", "))
- f.close()
- x = random.randint(0,52)
- print("You got the ", cardarray[x][0])
- hitorburn = input("Do you want to hit or burn?")
- if hitorburn == "hit":
- y = random.randint(0,52)
- print("This time you got the ", cardarray[y][0])
- if (cardarray[x][0][0] + cardarray[y][0][0]) == 21:
- print("Blackjack! You win! You earned")
- else:
- hitorburn2 = input("Do you want to hit or burn again?").lower()
- if hitorburn2 == "hit":
- z = random.randint(0,52)
- print("Now you got the ", cardarray[z][0])
- if (cardarray[x][0][0] + cardarray[y][0][0] + cardarray[z][0][0]) == 21:
- print("Blackjack! You win! You earned")
- # elif (cardarray[x][0][0] + cardarray[y][0][0] + cardarray[z][0][0]) > 21:
- # print("Unlucky, you went over 21!")
- else:
- hitorburn3 = input("Do you want to hit or burn one more time?").lower()
- if hitorburn3 == "hit":
- j = random.randint(0,52)
- print("You got the ", cardarray[z][0])
- if (cardarray[x][0][0] + cardarray[y][0][0] + cardarray[z][0][0]) == 21:
- print("Blackjack! You win! You earned")
- elif hitorburn3 == "burn":
- print("hello")
- elif hitorburn2 == "burn":
- print("hello")
- elif hitorburn == "burn":
- print("hello")
- # elif (cardarray[x][0][0] + cardarray[y][0][0] + cardarray[z][0][0]) > 21:
- # print("Unlucky, you went over 21!")
- # print(cardarray[x][0][0])
Add Comment
Please, Sign In to add comment