我的if語句有效,但其他人不能幫助我嗎? 這是我的代碼。順便說一句,如果有人知道如何在一次之後要求重試會很棒!Python if else語句
import random
print('choose a number between 1 and 10,if you guess right you get 10 points if you guess wrong you lose 15points')
answer = input()
randint = random.randint(0,2)
print('the answer is ',randint)
if [answer == randint]:
print('gratz! you win 10points!')
else:
print('you lose 15points!')
這聽起來像是功課... – purpletentacle
嘗試刪除if語句。 –
'randint'不是1到10之間的數字... –