import random
gCount = 1
pChoice = ("sdq")
while gCount == 10 or pChoice == ("q"):
pChoice = input("Steal, Deal or Quit [s|d|q]?")
if pChoice != ("q"):
gCount += 1
print("Jackpot:100")
#Determing and displaying choice
if pChoice == ("s"):
print("C: Steal")
elif pChoice == ("d"):
print ("C: Deal")
#Determing and displaying computer choice
cChoice= random.randint(1,2)
if cChoice == 1:
print("Comp:Steal")
elif cChoice == 2:
print("Comp:Deal")
#Determining and displaying whether the player wins or loses, as well as scores
# for that round.
if pChoice == ("s") and cChoice == 1:
print("S: 0 | 0")
print("You lose! You get nothing!")
elif pChoice == ("d") and cChoice == 1:
print("S: 0 | 100")
print("You lose! You get nothing!")
elif pChoice == ("d") and cChoice == 2:
print("S: 50 | 50")
print("Draw! Split pot!")
else:
print("S: 100 | 0")
print("You win! Jackpot!")
在IDLE終端中運行時,該代碼被返回IDLE被返回 '=== RESTART ===' 線,但沒有其他輸出
================================ RESTART ================================
。我不確定是什麼導致了這一點。
Python 3.4.3
32-bit IDLE for 3.4.3
Windows 7 64-bit
從字面上看,它只是在返回RESTART之前或之後沒有任何東西嗎? – SuperBiasedMan
這是你的確切實際代碼?在你的第一個'while'之後,你的行上有一個縮進錯誤。 – Kevin
如何在IDLE中運行腳本? – poke