我有我的Python腳本中的問題,因爲當這個問題來了:Python |跳過USER_INPUT
("Is there problem with the software or hardware? ")
當我輸入「軟件」我的第一個軟件問題來了
("Is your phone freezing/stuttering? ")
所以,如果我回答是一個解決方案出現b'`ut如果我輸入否然後我的硬件問題出現,但我不希望這種情況發生。
這裏是我的腳本:
phone2 = input("Is there problem with the software or hardware? ") #Question
if phone2 == "Software" or phone2 == "software" :
def foo():
while True:
return False
s1 = input("Is your phone freezing/stuttering? ")
if s1 == "Yes" or s1 == "yes" :
print("Try deleting some apps and this might help with your problem")
if s1 == "No" or s1 == "no" :
def foo():
while True:
return False
if phone2 == "Hardware" or phone2 == "hardware" :
def foo():
while True:
return False
h1 = input("Does your phone switch on? ")
if h1 == "No" or h1 == "no" :
print("There might be a issue with your battery. I recommend replacing it with the help of a specialist")
if h1 == "Yes" or h1 == "yes" :
def foo():
while True:
return False
'def foo():while True:return False'你認爲這樣做是什麼? –
使用'if ..... elif'而不是兩個'if ... if',甚至'if ... else' – depperm