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 =  8*60
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(n_tasks):
    high_priority = priority.index(min(priority))
    time_priority = time[high_priority]
    print (f"  {i+1}          {priority[high_priority]}              {time[high_priority]}")
    priority.pop(high_priority)
    time.pop(high_priority)
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" {max_value} is the highest test in the list and has an index of {max_index}")   # print out results in formatted statement
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" {max_value} is the highest test in the list and has an index of {max_index} and takes {task_time} minutes")    # print out values as in Step #2 plus the time it takes to complete task
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"{max_value} is the highest test in the list and has an index of {max_index} and takes {task_time} minutes")
#
# Add conditional to see if this task can be completed in the allotted time
if ((time_used+task_time) < max_time) :
    time_used += task_time
    print(f"Added Test {max(test_list)} with total used time of {time_used} minutes")
    # if conditional is true, i.e., task can be completed update time_used
    # add print statements
# 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]
#
# define number of tasks:     don't hardwire this but rather use the len() command
# Finds number of tasks
n_tasks = len(priority)
# Max time 8 hours * 60 minutes = 480 minutes
max_time =  8*60
# Prints out the header of the table
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
#Prints the table out in order as presented in list
for i in range(n_tasks):
    print (f"  {i+1}          {priority[i]}              {time[i]}")
#
# Initialize any variables before loop
# Initialize the time used as 0
used_time = 0
# 
# add for loop to go through all tasks
# For loop for greedy algorithm 
for i in range(n_tasks) :
# find highest priority left and task number it corresponds to from Step 3/4
    # Finds maximum's index in list representing the highest priority and the time associated with it
    high_priority = priority.index(max(priority))
    time_priority = time[high_priority]
    # If statement to check if task time can fit in to used time and not over max time
    if (used_time+time_priority <= max_time):
        # add used time to variable 
        used_time += time_priority
        # Print out statement showing which task was added and time associated. Print total used time
        print(f"Added task {priority[high_priority]} with {time_priority} used and with total used time of {used_time}")
        # Zero out both task priority and time as it is added to used time
        priority[high_priority] = 0
        time[high_priority] = 0
          
#          
# Print out the total time used for all tasks in day 1
print(f"Finished day 1 using {used_time} minutes")
 
# 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]
#
# define number of tasks:     don't hardwire this but rather use the len() command
# Finds number of tasks
n_tasks = len(priority)
# Max time 8 hours * 60 minutes = 480 minutes
max_time =  8*60
# Prints out the header of the table
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
#Prints the table out in order as presented in list
for i in range(n_tasks):
    print (f"  {i+1}          {priority[i]}              {time[i]}")
#
# Initialize any variables before loop
# Initialize the time used as 0
used_time = 0
task_number = 0
# 
# add for loop to go through all tasks
# For loop for greedy algorithm 
for i in range(n_tasks) :
# find highest priority left and task number it corresponds to from Step 3/4
    # Finds maximum's index in list representing the highest priority and the time associated with it
    high_priority = priority.index(max(priority))
    time_priority = time[high_priority]
    # If statement to check if task time can fit in to used time and not over max time
    if (used_time+time_priority <= max_time):
        # add used time to variable 
        used_time += time_priority
        task_number += 1
        # Print out statement showing which task was added and time associated. Print total used time
        print(f"Added task {priority[high_priority]} with {time_priority} minutes used and with total used time of {used_time}")
        # Zero out both task priority and time as it is added to used time
        priority[high_priority] = 0
        time[high_priority] = 0
    # If statement to check if used_time summed with the time is greater or equal to max_time
    if (used_time+time_priority >= max_time):
        # breaks the for loop
        break
          
#          
# Print out the total time used for all tasks in day 1
print(f"Finished day 1 using {used_time} minutes and completed {task_number} tasks.")
 
# Input problem specific data 
old_priority = [ 2, 6, 1, 7, 10, 8, 5]
time = [30,200,20,70,120,60, 150]
n_tasks = len(old_priority)
#
# 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
for i in range(n_tasks):
    priority.append(old_priority[i]/time[i])
# Remainder of code should be the same; this is because we called the new list which contained the ratios the same as
# before.
max_time =  8*60
# Prints out the header of the table
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
#Prints the table out in order as presented in list
for i in range(n_tasks):
    print (f"  {i+1}          {round(priority[i],3)}              {time[i]}")
#
# Initialize any variables before loop
# Initialize the time used as 0
used_time = 0
task_number = 0
# 
# add for loop to go through all tasks
# For loop for greedy algorithm 
for i in range(n_tasks) :
# find highest priority left and task number it corresponds to from Step 3/4
    # Finds maximum's index in list representing the highest priority and the time associated with it
    high_priority = priority.index(max(priority))
    time_priority = time[high_priority]
    # If statement to check if task time can fit in to used time and not over max time
    if (used_time+time_priority <= max_time):
        # add used time to variable 
        used_time += time_priority
        task_number += 1
        # Print out statement showing which task was added and time associated. Print total used time
        print(f"Added task {priority.index(priority[high_priority])+1} with {time_priority} minutes used and with total used time of {used_time}")
        # Zero out both task priority and time as it is added to used time
        priority[high_priority] = 0
        time[high_priority] = 0
    # If statement to check if used_time summed with the time is greater or equal to max_time
    if (used_time+time_priority >= max_time):
        # breaks the for loop
        break
          
#          
# Print out the total time used for all tasks in day 1
print(f"Finished day 1 using {used_time} minutes and completed {task_number} tasks.")