-1
我試圖比較2個數字,一個是隨機生成的,一個是從用戶輸入中獲得的。邏輯陳述不正確評估?
#SkillT is a user-interactive text box, and skills is a dropdown list.
#This is using PyQT5, but I don't think that's pertinent to my question.
Skl = int(SkillT.text())
def calcs():
a = skills.currentText()
b = random.randint(0,100)
if a == "Lethality":
if b <= Skl:
print("AAAA")
print(b)
else:
print(b)
當我運行該程序,b <= Skl
總是計算爲false,即使SKL被設置爲一個數字,如1000是有一些問題,我的代碼?我對Python編程很陌生,所以請善待。
所以它打印(b)'。 「Skl」的價值和「b」的價值是什麼?確保它不是「a ==」,即「假」的致命性。 – AChampion