if card == "J" or card == "Q" or card == "K":
return 10
elif card == "A":
return 1
I saw in the solution part that I have to write one more “return” at the end of the first task, but I don’t understand why.
I would appreciate if someone help me find out the reason.
def value_of_card(card):
if card == “J” or card == “Q” or card == “K”:
return 10
elif card == “A”:
return 1
another thing that I don’t understand and I think it’s because I don’t know how to play blackjack is that aren’t the cards just letters like J Q K A? Why should a number be a possible input?
p.s: don’t why the indentations can not be shown when I write the full function.
The card represents the face of a playing card. A standard deck of playing cards has cards A 2 3 4 5 6 7 8 9 10 J Q K. You need to be able to handle any/all of these values.
def value_of_card(card):
if card == "J" or card == "Q" or card == "K":
return 10
elif card == "A":
return 1
else:
return int(card)
it still doesn’t work, as u said I handled the else part, but idk why it’s not working again.
I don’t know how to deal with the problems with my code :(
I don’t want to check the solutions either.