# Divide List Elements by Float in Python (Example)

In this tutorial, youâ€™ll learn how to divide each element of a list by a floating-point number in the Python programming language.

Letâ€™s dive into it!

## Example

Sometimes, you may need to divide each element of a list by a floating-point number in Python. This operation is useful when you want to scale or normalize the values in the list based on a specific factor.

To divide each element of a list by a float in Python, you can follow these steps:

Step 1: Declare the list.

Step 2: Define the float value.

Step 3: Divide each element by the float value.

Hereâ€™s an example of dividing list elements by a float:

```# Step 1: Declare the list
my_list = [10, 20, 30, 40, 50]

# Step 2: Define the float value
divisor = 2.5

# Step 3: Divide each element by the float value
for i in range(len(my_list)):
my_list[i] /= divisor

# Print the updated list
print(my_list)  # Output: [4.0, 8.0, 12.0, 16.0, 20.0]```

In the above example, we have a list named `my_list` containing integer values. We defined a float value `divisor` as 2.5. Then, using a for loop, we divided each element of the list by the float value. Finally, we printed the updated list.

## Video, Further Resources & Summary

Do you need more explanations on dividing list elements by a float in Python? Then you should have a look at the following YouTube video of the Statistics Globe YouTube channel.

Furthermore, you could have a look at some of the other tutorials on Statistics Globe:

This post has shown how to divide each element of a list by a float in Python. In case you have further questions, you may leave a comment below.

This page was created in collaboration with Ã–mer Ekiz. You may have a look at Ã–merâ€™s author page to read more about his academic background and the other articles he has written for Statistics Globe.

Subscribe to the Statistics Globe Newsletter