version = "Alpha"
print " ------------------------------------"
print "| BlackJack |"
print " ------------------------------------"
print" V: " + version + " -by cookie"
print ""
from random import randint
CartaA1 = (randint(1,13))
CartaA2 = (randint(1,13))
Carta = (randint(1,13))
Carta2 = (randint(1,13))
print ""
print "Primera carta del adversario:", CartaA2
print ""
print ""
print ""
print "Su carta", Carta
Accion = raw_input("Desea agarrar otra carta o dejar así.(Agarrar/Esperar)")
if Accion = "Agarrar"
print "Sus cartas son:", Carta, Carta2
我在if Accion = "Agarrar
上收到了错误:
line 19
if Accion = "Agarrar"
^
SyntaxError: invalid syntax
答案 0 :(得分:1)
=
运算符仅用于Python中的赋值。如果您正在进行比较(就像您在if
声明中那样),则需要==
。你还需要在行尾添加一个冒号(所有引入块的Python语句都有冒号):
if Accion == "Agarrar":