Reputation: 151
Yesterday I posted a question regarding a NameError
I am getting when running my program. From the comments I got on my post I decided to ask the same question, only this time adding a link to my Github repository so you could get a complete reference and context to my specific problem, hopefully helping me understand what I should do to solve my problem. This is my Github repository:
https://github.com/AlonSalzmann/Blackjack
the problem I'm having is getting this error:
Traceback (most recent call last):
File "C:/Users/pc/PycharmProjects/Blackjack/Game Flow/Game_Flow.py", line 83, in <module>
player_turn()
File "C:/Users/pc/PycharmProjects/Blackjack/Game Flow/Game_Flow.py", line 29, in player_turn
user_decision = input('would you like to hit or hold?')
File "<string>", line 1, in <module>
NameError: name 'hit' is not defined
While running this block of code:
def player_turn():
if sum(player_card_numbers) < 21:
user_decision = input('would you like to hit or hold?')
if user_decision == 'hit':
player_cards.append(deck.draw())
print player_cards, dealer_cards
player_turn()
elif user_decision == 'hold':
print "Dealer's turn!"
dealer_turn()
else:
print "player must choose 'hit' or 'hold'"
player_turn()
elif sum(player_card_numbers) == 21:
print "Blackjack!"
dealer_turn()
else:
print "Player Burnt! \nDealer's turn!"
dealer_turn()
This block of code is located in "Gameflow.py" in the "Gameflow" folder. Once again i would really appreciate an explanation, hopefully made easier now that the entire project is accessible with my Github account. This project is written in python 2.7
Upvotes: 0
Views: 96