Guest User

Untitled

a guest
Jan 3rd, 2021
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. import random
  2.  
  3. credits = 500
  4.  
  5. enter = input("Hello! I am the dealer for this game of BlackJack! Press enter to continue!")
  6.  
  7. f = open("cards.txt","r")
  8. lines = f.readlines()
  9. cardarray = []
  10. for line in lines:
  11. cardarray.append(line.strip().split(", "))
  12. f.close()
  13.  
  14.  
  15. x = random.randint(0,52)
  16. print("You got the ", cardarray[x][0])
  17. hitorburn = input("Do you want to hit or burn?")
  18. if hitorburn == "hit":
  19. y = random.randint(0,52)
  20. print("This time you got the ", cardarray[y][0])
  21. if (cardarray[x][0][0] + cardarray[y][0][0]) == 21:
  22. print("Blackjack! You win! You earned")
  23. else:
  24. hitorburn2 = input("Do you want to hit or burn again?").lower()
  25. if hitorburn2 == "hit":
  26. z = random.randint(0,52)
  27. print("Now you got the ", cardarray[z][0])
  28. if (cardarray[x][0][0] + cardarray[y][0][0] + cardarray[z][0][0]) == 21:
  29. print("Blackjack! You win! You earned")
  30. # elif (cardarray[x][0][0] + cardarray[y][0][0] + cardarray[z][0][0]) > 21:
  31. # print("Unlucky, you went over 21!")
  32. else:
  33. hitorburn3 = input("Do you want to hit or burn one more time?").lower()
  34. if hitorburn3 == "hit":
  35. j = random.randint(0,52)
  36. print("You got the ", cardarray[z][0])
  37. if (cardarray[x][0][0] + cardarray[y][0][0] + cardarray[z][0][0]) == 21:
  38. print("Blackjack! You win! You earned")
  39. elif hitorburn3 == "burn":
  40. print("hello")
  41. elif hitorburn2 == "burn":
  42. print("hello")
  43. elif hitorburn == "burn":
  44. print("hello")
  45. # elif (cardarray[x][0][0] + cardarray[y][0][0] + cardarray[z][0][0]) > 21:
  46. # print("Unlucky, you went over 21!")
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56. # print(cardarray[x][0][0])
Add Comment
Please, Sign In to add comment