-
-
Save tanayseven/3906897 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python | |
process_queue = [] | |
total_wtime = 0 | |
n = int(raw_input('Enter the total no of processes: ')) | |
for i in xrange(n): | |
process_queue.append([])#append a list object to the list | |
process_queue[i].append(raw_input('Enter p_name: ')) | |
process_queue[i].append(int(raw_input('Enter p_arrival: '))) | |
total_wtime += process_queue[i][1] | |
process_queue[i].append(int(raw_input('Enter p_bust: '))) | |
print '' | |
process_queue.sort(key = lambda process_queue:process_queue[1]) | |
print 'ProcessName\tArrivalTime\tBurstTime' | |
for i in xrange(n): | |
print process_queue[i][0],'\t\t',process_queue[i][1],'\t\t',process_queue[i][2] | |
print 'Total waiting time: ',total_wtime | |
print 'Average waiting time: ',(total_wtime/n) |
the program isn't running at all it is saying missing parentheses in call to print line 11 i don't know whats the problem can you debug it !!!!please
this program is written in python 2.7 so if you want to run this program in python 3.x you have to put parenthesis "()" after each print and also rename raw_input to input as python 3.x does not support raw_input
in 11 line i am facing a problem that it is not runnning in python please tell sir what a proble
this code is written in python2 .
and if I'm not wrong you are using python 3 . That's why it shows an error.
#!/usr/bin/env python
process_queue = []
total_wtime = 0
n = int(input('Enter the total no of processes: '))
for i in range(n):
process_queue.append([])#append a list object to the list
process_queue[i].append(input('Enter p_name: '))
process_queue[i].append(int(input('Enter p_arrival: ')))
total_wtime += process_queue[i][1]
process_queue[i].append(int(input('Enter p_bust: ')))
print ("")
process_queue.sort(key = lambda process_queue:process_queue[1])
print ("ProcessName\tArrivalTime\tBurstTime")
for i in range(n):
print (process_queue[i][0],'\t\t',process_queue[i][1],'\t\t',process_queue[i][2])
print ('Total waiting time: ',total_wtime)
print ('Average waiting time: ',(total_wtime/n))
in 11 line i am facing a problem that it is not runnning in python please tell sir what a proble