-2
有沒有辦法讓代碼行在不同的代碼行上繼續?例如:Python:使代碼在不同的行上繼續
a = raw_input("1 or 2")
if a == "1" :
a = raw_input("3 or 4")
if a == "3" :
*line of code that makes the script progress at line #14*
if a == "4" :
*line of code that makes the script progress at line #14*
if a = "2" :
a = raw_input("5 or 6")
if a == "5" :
*line of code that makes the script progress at line #14*
if a == "6" :
*line of code that makes the script progress at line #14*
print ("chocolate")
(^line #14^)
你有更好的例子,更接近你的真實世界的用例嗎?這個例子可以簡化爲'if int(a)<7:print('chocolate')'。 –