HW HACK 1

# Define a basic list
my_list = [1, 2, 3, 4, 5]

#Sum of the first and last elements in the list using list procedures
sum = my_list[0] + my_list[-1]

# Reverse the list
reversed_list = my_list[::-1]

# Get the index of the value 3 in the reversed list
index3 = reversed_list.index(3)

# Print the results
print(f"The sum of the first and last values in your list is {sum}")
print(f"Your list reversed is {reversed_list}")
print(f"The position of number 3 in your list is {index3+1}")
The sum of the first and last values in your list is 6
Your list reversed is [5, 4, 3, 2, 1]
The position of number 3 in your list is 3

HW HACK 2

import math
# define a python func to determine worst case iterations for an array of len 20

def worstIterations(array_length):
    return int(math.ceil(math.log2(array_length)))

array_length = 20

worstCase = worstIterations(array_length)

print(worstCase)
5

HW Question 3

The answer is A as you are multiplying every integer in the list [10,20,30,40,50] by 2