We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

List Division

Remember, in Python you can divide two numbers using the / operator. For example:

print(6 / 2)  # 3.0
print(8 / 4)  # 2.0

You can also iterate over each item in a list using a for in loop. For example:

numbers: list[int] = [1, 7, 3, 2, 5]
for num in numbers:
    print(num)
# 1
# 7
# 3
# 2
# 5

Assignment

Complete the divide_list() function. It takes a list and a number as input, and should return a new list that contains all the elements of the original list after dividing them by the second input.

For example:

divided_list: list[float] = divide_list([6, 8, 10], 2)
print(divided_list)
# [3.0, 4.0, 5.0]

Do not round the resulting float numbers; just return them as they are.