I'm trying to get my head around list comprehension at the moment, and trying to build a blackkjack game using as much of it as possible. Im stuck at this particular point:
elif card == (char for char in ["K", "J", "Q"]):
print("Detected facecard")
I understand it would possibly be easier to use a dictionary or some alternative method, or even just expand the loop out, but Im specifically trying to understand why this wont work.
printing char for char in .... yields the object type rather than the objects.
Any suggestions? Thanks in advance
Aucun commentaire:
Enregistrer un commentaire