0
我正在爲我的朋友製作生日禮物。我正在製作一個有史以來每一個奇蹟角色的數據庫,到目前爲止我已經完成了其中的兩個,去測試它,它說錯誤。我已經看遍了所有的代碼,我已經嘗試了很多,但它似乎並沒有工作。這是代碼。努力在python中找到錯誤
from time import sleep
print ("Welcome to the Marvel Database please input the name of a marvel character you want to research. Please make sure you type the name as accurately as possible.")
character = input()
if character == 'A-Bomb':
print ("loading", sleep(.5), ".", sleep(.5), ".", sleep(.5), ".")
print ("Character found.")
sleep(.5)
print ("Name is A-Bomb.")
sleep(1)
print ("Unknown if they or it are Hero or Villan.")
sleep(1)
print ("No infomation found.")
sleep(1)
elif character == 'a-bomb':
print ("loading", sleep(.5), ".", sleep(.5), ".", sleep(.5), ".")
print ("Character found.")
sleep(.5)
print ("Name is A-Bomb")
sleep(1)
print ("Unknown if they or it are Hero or Villan.")
sleep(1)
print ("No infomation found")
sleep(1)
elif character == 'a bomb':
print ("loading", sleep(.5), ".", sleep(.5), ".", sleep(.5), ".")
print ("Character found.")
sleep(.5)
print ("Name is A-Bomb")
sleep(1)
print ("Unknown if they or it are Hero or Villan.")
sleep(1)
print ("No infomation found")
sleep(1)
elif character == 'A-bomb':
print ("loading", sleep(.5), ".", sleep(.5), ".", sleep(.5), ".")
print ("Character found.")
sleep(.5)
print ("Name is A-Bomb")
sleep(1)
什麼是錯誤? – dorukayhan
您需要突出顯示您的代碼,並在將來使用「{}」按鈕。 –
'print(sleep(0.5))'將打印'time.sleep()'的返回值,它總是'None'。並且請記住'print()'將在'print()'之前被評估,所以三重睡眠打印或多或少等於'sleep(1.5);打印(...)'。 – dhke