# Divide List Elements by Integer in Python (Example)

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

Letâ€™s dive into it!

## Example

At times, you may need to divide each element of a list by an integer in Python. This operation is useful when you want to distribute or scale the values in the list based on a specific factor.

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

Step 1: Declare the list.

Step 2: Define the integer value.

Step 3: Divide each element by the integer value.

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

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

# Step 2: Define the integer value
divisor = 5

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

# Print the updated list
print(my_list)  # Output: [2, 4, 6, 8, 10]```

In the above example, we have a list named `my_list` containing integer values. We defined an integer value `divisor` as 5. Then, using a for loop, we divided each element of the list by the integer value using the floor division operator `//=`. Finally, we printed the updated list.

## Video, Further Resources & Summary

Do you need more explanations on dividing list elements by an integer 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 an integer 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