1 回答
![?](http://img1.sycdn.imooc.com/5333a2320001acdd02000200-100-100.jpg)
TA贡献1848条经验 获得超2个赞
除非我遗漏了什么,否则 Python 使用缩进来表示作用域而不是大括号 ( {})。
修复这个问题,以及一些奇怪的缩进,test如果这就是你想要的,它会打印“”
import random
deste=[10,10,10,10,9,8,7,6,5,4,3,2,1,
10,10,10,10,9,8,7,6,5,4,3,2,1,
10,10,10,10,9,8,7,6,5,4,3,2,1,
10,10,10,10,9,8,7,6,5,4,3,2,1]
desteo=[]
desteb=[]
pas=3
oyunbitti=0
desteo.append(random.choice(deste))
deste.remove(desteo[-1])
desteb.append(random.choice(deste))
deste.remove(desteb[-1])
def hamle():
print("Destenin değeri : ",sum(desteo))
print("Bilgisayar destesinin değeri : ",sum(desteb))
print("Kalan pas hakkın: ",pas)
yanit=input("Hamleni yap:\n1 Kart al\n2 Pas geç\n")
if yanit==1: # don't use curly braces
desteo.append(random.choice(deste)) # these have been indented
deste.remove(desteo[-1])
if sum(desteo)>21: # no curly braces here either
oyunbitti=1
print("test")
添加回答
举报