当我只在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!'
缩进
if
子句:更好的做法是使用
raw_input
和字符串,而不是input
,这会评估您的输入,可能对您的代码有害相关问题 更多 >
编程相关推荐