priority = [2, 6, 1, 7,10,8,5]
time = [30,200,20,70,120,60,150]
#
# define number of tasks: don't hardwire this but rather use the len() command
n_tasks = len(priority)
max_time = 480
print ( f"TASK PRIORITY TIME TO COMPLETE")
for task in range(0,n_tasks):
print (f" {task + 1} {priority[task]} {time[task]}")
# you need to add an appropriate for loop here and modify the next print statement so that you can print out all tasks

```
TASK PRIORITY TIME TO COMPLETE
1 2 30
2 6 200
3 1 20
4 7 70
5 10 120
6 8 60
7 5 150
```

test_list = [ 4, 5, 3, 7, 11, 2]
max_value = max(test_list) # use function max() to find maximum value in list
max_index = test_list.index(max_value) # use method list.index () to find the index where this max occurs
print (f"The Max value is: {max_value} and the Index is: {max_index}") # print out results in formatted statement

```
The Max value is: 11 and the Index is: 4
```

test_list = [ 4, 5, 3, 7, 11, 2]
time_list = [30, 45, 20, 120, 90, 70 ]
max_value = max(test_list)
max_index = test_list.index(max_value)
task_time = time_list[max_index] # input the time it takes to complete this task
print(f"The Max value is: {max_value} and the Index is: {max_index} the max Time it would take is: {task_time}") # print out values as in Step #2 plus the time it takes to complete task

```
The Max value is: 11 and the Index is: 4 the max Time it would take is: 90
```

max_time = 6 * 60 # this is not the maximum time available for your example but rather for testing
time_used = 3 * 60
#
# Following 6 statements are from Step 3
test_list = [ 4, 5, 3, 7, 11, 2]
time_list = [30, 45, 20, 120, 90, 70 ]
max_value = max(test_list)
max_index = test_list.index(max_value)
task_time = time_list[max_index]
print(f"The Max value is: {max_value} and the Index is: {max_index} the max Time it would take is: {task_time}")
#
# Add conditional to see if this task can be completed in the allotted time
if (task_time < max_time ) :
updated_time = time_used + task_time
print(f"task can be completed updated used time is {updated_time} ")
else:
print("Cannot complete")
# if conditional is true, i.e., task can be completed update time_used
# add print statements

```
The Max value is: 11 and the Index is: 4 the max Time it would take is: 90
task can be completed updated used time is 270
```

# Input problem specific data and print it out from Step 1
priority = [ 2, 6, 1, 7, 10, 8, 5]
time = [30,200,20,70,120,60, 150]
n_tasks = len(priority)
max_time = 480
total_time = 0
curr_p = 0
curr_t = 0
print ( f"TASK PRIORITY TIME TO COMPLETE")
#
# Initialize any variables before loop
#
# add for loop to go through all tasks
#
for task in range(0,n_tasks):
max_p = max(priority)
i = priority.index(max_p)
t = time[i]
total_time = total_time + t
print (f" {task + 1} {max_p} {t}")
if (curr_t + t <= max_time):
print(f"Do task {task + 1} with time of: {t} ")
curr_t = curr_t + t
print(f"Time used on this task was {t} and the Priority was {max_p} The time remaining is {max_time-curr_t}")
else:
print(f"Task {task + 1} cannot be completed in the alloted time" )
priority[i] = 0
print(f"Total time used for all task: {total_time}")
# find highest priority left and task number it corresponds to from Step 3/4
#
# zero out this entry in the priority list so you won't find it again
#
# add conditional to check to see if task can be completed as in Step 4
#
# Print out the total time used for all tasks in day 1

```
TASK PRIORITY TIME TO COMPLETE
1 10 120
Do task 1 with time of: 120
Time used on this task was 120 and the Priority was 10 The time remaining is 360
2 8 60
Do task 2 with time of: 60
Time used on this task was 60 and the Priority was 8 The time remaining is 300
3 7 70
Do task 3 with time of: 70
Time used on this task was 70 and the Priority was 7 The time remaining is 230
4 6 200
Do task 4 with time of: 200
Time used on this task was 200 and the Priority was 6 The time remaining is 30
5 5 150
Task 5 cannot be completed in the alloted time
6 2 30
Do task 6 with time of: 30
Time used on this task was 30 and the Priority was 2 The time remaining is 0
7 1 20
Task 7 cannot be completed in the alloted time
Total time used for all task: 650
```

priority = [ 2, 6, 1, 7, 10, 8, 5]
time = [30,200,20,70,120,60, 150]
n_tasks = len(priority)
max_time = 480
total_time = 0
curr_p = 0
curr_t = 0
print ( f"TASK PRIORITY TIME TO COMPLETE")
#
# Initialize any variables before loop
#
# add for loop to go through all tasks
#
for task in range(0,n_tasks):
max_p = max(priority)
i = priority.index(max_p)
t = time[i]
total_time = total_time + t
print (f" {task + 1} {max_p} {t}")
if (curr_t + t <= max_time):
print(f"Do task {task + 1} with time of: {t} ")
curr_t = curr_t + t
print(f"Time used on this task was {t} and the Priority was {max_p} The time remaining is {max_time-curr_t}")
if (curr_t == max_time):
break
else:
print(f"Task {task + 1} cannot be completed in the alloted time" )
priority[i] = 0
print(f"Total time used for all task: {total_time}")
#
# find highest priority left and task number it corresponds to from Step 3/4
#
# zero out this entry in the priority list so you won't find it again
#
# add conditional to check to see if task can be completed as in Step 4
# if this conditional is satisfied then add another conditional to check if time_used = max_time; if so break out of loop
#
# Print out the total time used for all tasks in day 1

```
TASK PRIORITY TIME TO COMPLETE
1 10 120
Do task 1 with time of: 120
Time used on this task was 120 and the Priority was 10 The time remaining is 360
2 8 60
Do task 2 with time of: 60
Time used on this task was 60 and the Priority was 8 The time remaining is 300
3 7 70
Do task 3 with time of: 70
Time used on this task was 70 and the Priority was 7 The time remaining is 230
4 6 200
Do task 4 with time of: 200
Time used on this task was 200 and the Priority was 6 The time remaining is 30
5 5 150
Task 5 cannot be completed in the alloted time
6 2 30
Do task 6 with time of: 30
Time used on this task was 30 and the Priority was 2 The time remaining is 0
Total time used for all task: 630
```

# Input problem specific data
old_priority = [ 2, 6, 1, 7, 10, 8, 5]
time = [30,200,20,70,120,60, 150]
# n_tasks =
#
# Create new priority list containing ratios
#
priority = [] # initialize the list which contains the new priorities which are original priority divided by
# time it takes to complete this task
# add for loop to create this list
# use method .append() to create elements of the new priority list
#
# Remainder of code should be the same; this is because we called the new list which contained the ratios the same as
# before.