我的程序一直運行,直到到達「if」部分,然後它停止工作。有任何想法嗎?如何修復我的Python代碼?
import random
skill = str()
skill2 = str()
strength1 = str()
strength2 = str()
final = str()
strength_modifier = str()
skill_modifier = str()
dice = int()
strength1 = input("Please enter your strength level for character 1: ")
print(strength1)
skill1 = input("Please enter your skill level for character 2: ")
print(skill1)
strength2 = input("Please enter your strength level for character 2: ")
print(strength2)
skill2 = input("Please enter your strength level for skill 2: ")
print(skill2)
if strength1 > strength2:
strength_modifier =(int(strength1)-int(strength2))
print(strength_modifier)
if strength2 > strength1:
strength_modifier = (int(strength2)-int(strength1))
print(strength_modifier)
if skill1 > skill2:
skill_modifier = (int(skill1)-int(skill2))
print(skill_modifier)
if skill2 > skill1:
skill_modifier = (int(skill2)-int(skill1))
print(skill_modifier)
可以請人剛修好它,並張貼在這裏,請:L
你必須更具體 - 這個程序做什麼,你接受什麼輸入,是python3 vs 2.7等等。 –
你看到什麼錯誤? – elbaulp
我需要它來找出兩個數字之間的差異,當它獲得「如果」位,這就是爲什麼當它到達「如果」位,我試圖使它減去最大數字beucase中的最小數字,然後生病差異。 –