0
我試着跑了二十一點遊戲21寫了下面的模塊中Python
卻得到一個錯誤說:Python Blackjack運行模塊空閒錯誤?
Unindent does not match any outer indentation level.
問題
請幫助解決錯誤。
也就是有一個穩定的選項來運行模塊,並讓他們與
python
檢查,我知道有,但一個易於使用的一個沒有python
添加代碼,只需運行它以檢查代碼得到了壞籤?
如果截圖不清:提前
koloda = [6,7,8,9,10,2,3,4,11] * 4
import random
random.shuffle(koloda)
print(' Lets play blackjack, shall we? ')
count = 0
while True:
choice = input(' Will you pick another card? y/n\n ')
if choice == ' y ':
current = koloda.pop()
print(' You got a higher card %d ' %current)
count += current
if count > 21:
print(' Sorry, you lost ')
break
elif count == 21:
print(' Congrats, you got 21! ')
break
else:
print(' You have %d points. ' %count)
elif choice -- 'n':
print(' You have %d points and you ended this game. ' %count)
break
print('See you again!')
感謝
我覺得你不習慣python,在python縮進級別是什麼事情來定義塊。你的縮進是凌亂的。你已經把一個elif塊放在else塊之後。您應該將此代碼發佈到[代碼評論](http://codereview.stackexchange.com/) – caiohamamura