Untitled
unknown
python
2 years ago
1.2 kB
2
Indexable
Never
import random #~~~Trabajo Practico 1~~~ #Mazo de cartas cartas = (2, 3, 4, 5, 6, 7, 8, 9, 10, "J", 'Q', 'K', 'A') palo = ("Pica", "Corazón", "Diamante", "Trébol") #Cartas del crupier crupier_carta1 = random.choice(cartas) crupier_carta2 = random.choice(cartas) crupier_total = 0 # J, Q y K valen 10 if crupier_carta1 == "J" or crupier_carta1 == "Q" or crupier_carta1 == "K": crupier_valor1 = 10 if crupier_carta2 == "J" or crupier_carta2 == "Q" or crupier_carta2 == "K": crupier_valor2 = 10 # Cuanto valen si no son J, Q y K if crupier_carta1 != "J" and crupier_carta1 != "Q" and crupier_carta1 != "K" and crupier_carta1 != "A": crupier_valor1 = crupier_carta1 if crupier_carta2 != "J" and crupier_carta2 != "Q" and crupier_carta2 != "K" and crupier_carta2 != "A": crupier_valor2 = crupier_carta2 #Total valor de cartas del crupier crupier_total = crupier_valor1 + crupier_valor2 # As if crupier_carta1 == 'A' and crupier_total <= 10: crupier_valor1 = 11 else: crupier_valor1 = 1 if crupier_carta2 == 'A' and crupier_total <= 10: crupier_valor2 = 11 else: crupier_valor2 = 1 #Imprimir print(crupier_total)