考慮下面的代碼,當我運行while循環執行後,if語句似乎不存在,我無法實現錯誤的地方。調查此代碼的錯誤?
while True:
IN = input(" ====================================== \n CPU scheduler console application: \n ====================================== \n 1.FCFS \n 2.SJF \n 3.Periority algorithm \n 4.Round robin \n 5.Exit \n Enter the chosen algorithm to run: ")
if IN == 1:
Processes = input(" Enter the processes times & arrival times separated by a comma: ")
BurstTimes = Processes[::2]
ArrivalTimes = Processes[1::2]
print BurstTimes, '\t\t', ArrivalTimes,
else:
print 'Good Bye!'
你正在使用哪個版本的python? –
@WinstonEwert從'print'判斷,2.x – aIKid
@alKid,doh!我應該看到這一點。 –