0
print("=======================PHONE ONE INPUT=============================")
global name1
name1=input("1). What brand is your phone? ")
condition=input("2). What is the condition of your phone (new or used)? ")
camera=input("3). Does the phone have a Camera (true or false)? ")
GPS=input("4). Does the phone have GPS (true or false)? ")
WiFi=input("5). Does the phone have WiFi (true or false)? ")
global price1
price1=input("6). Enter phone price($0-$1000) : ")
if (price1>"1000" or price1<"0"):
print("Invalid input, please re-run the simulation")
def main():
else:
computeValue(condition,GPS,WiFi,camera)
PhoneValue1=PhoneValue
我試圖讓上面的代碼重新運行,如果用戶輸入一個大於1000或小於0的值。我該怎麼做呢?重新運行基於輸入的代碼
請格式化您的代碼,以便我們可以閱讀它。選擇代碼,然後點擊輸入框頂部的大括號。謝謝。 – saulspatz
'而user_input> 1000或user_input <0:...'? – alfasin
如果我將它更改爲while循環,它將不會繼續,如果值介於0-1000之間 – noahdukehart