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")
# you need to add an appropriate for loop here and modify the next print statement so that you can print out all tasks
for i in range (0,n_tasks):
print (f" {i + 1} {priority[i]} {time[i]}")

```
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
print (f' the max value is {max_value}')
max_index = test_list.index (max_value) # use method list.index () to find the index where this max occurs
print (f"the max value's index is {max_index}") # print out results in formatted statement

```
the max value is 11
the max value's 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 = 90 # input the time it takes to complete this task
print (f'The max value is {max_value}, it is in index {max_index}, and this task takes 90 minutes') # print out values as in Step #2 plus the time it takes to complete task

```
The max value is 11, it is in index 4, and this task takes 90 minutes
```

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 = 90
print (f'The max value is {max_value}, it is in index {max_index}, and this task takes 90 minutes')
#
# Add conditional to see if this task can be completed in the allotted time
if ((3 * 60+90) < (6 * 60)) :
print (f'The task can be completed, and you will have used 4.5 hours')
# if conditional is true, i.e., task can be completed update time_used
# add print statements

```
The max value is 11, it is in index 4, and this task takes 90 minutes
The task can be completed, and you will have used 4.5 hours
```

# 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 = max(time)
max_value = max(priority)
max_index = priority.index (max_value)
task_time = time[max_index]
print ( f"TASK PRIORITY TIME TO COMPLETE")
for i in range (0,n_tasks):
print (f" {i + 1} {priority[i]} {time[i]}")
#
# Initialize any variables before loop
time_used = 0
current_priority = 0
#
# add for loop to go through all tasks
#
for i in range (0,n_tasks):
print ('************************************************************************************************')
max_value = max(priority)
max_index = priority.index (max_value)
task_time = time[max_index]
print (f'try task {max_index + 1}')
if ((task_time + time_used) <= max_time):
print (f'task {max_index + 1} has been added')
time_used = time_used + task_time
current_priority = current_priority + max_value
print (f'time used is {time_used}')
else :
(time_used == max_time)
print (f' task {max_index + 1} cannot be completed')
priority[max_index] = 0
#
# 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
# k we
# Print out the total time used for all tasks in day 1

```
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
************************************************************************************************
try task 5
task 5 has been added
time used is 120
************************************************************************************************
try task 5
task 5 cannot be completed
************************************************************************************************
try task 6
task 6 has been added
time used is 180
************************************************************************************************
try task 6
task 6 cannot be completed
************************************************************************************************
try task 4
task 4 cannot be completed
************************************************************************************************
try task 2
task 2 cannot be completed
************************************************************************************************
try task 7
task 7 cannot be completed
```

# 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 = max(time)
max_value = max(priority)
max_index = priority.index (max_value)
task_time = time[max_index]
print ( f"TASK PRIORITY TIME TO COMPLETE")
for i in range (0,n_tasks):
print (f" {i + 1} {priority[i]} {time[i]}")
#
# Initialize any variables before loop
time_used = 0
current_priority = 0
#
# add for loop to go through all tasks
#
for i in range (0,n_tasks):
print ('************************************************************************************************')
max_value = max(priority)
max_index = priority.index (max_value)
task_time = time[max_index]
print (f'try task {max_index + 1}')
if ((task_time + time_used) <= max_time):
print (f'task {max_index + 1} has been added')
time_used = time_used + task_time
current_priority = current_priority + max_value
print (f'time used is {time_used}')
if (time_used == max_time):
break
else :
(time_used == max_time)
print (f' task {max_index + 1} cannot be completed')
priority[max_index] = 0
#
# 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 2 30
2 6 200
3 1 20
4 7 70
5 10 120
6 8 60
7 5 150
************************************************************************************************
try task 5
task 5 has been added
time used is 120
************************************************************************************************
try task 5
task 5 cannot be completed
************************************************************************************************
try task 6
task 6 has been added
time used is 180
************************************************************************************************
try task 6
task 6 cannot be completed
************************************************************************************************
try task 4
task 4 cannot be completed
************************************************************************************************
try task 2
task 2 cannot be completed
************************************************************************************************
try task 7
task 7 cannot be completed
```

# 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.