This repository contains a Python script that performs the following tasks:
- Generates a list of random integers within the range [1, 5].
- Multiplies each integer in the list by 4 to create a new list.
- Filters the new list to include only the elements that are greater than 10.
- Calculates and prints the sum of the filtered elements.
- Python 3.x
- Clone the repository:
git clone https://github.com/yesrkaya/python-random-integer-processing.git
- Navigate to the repository directory:
cd python-random-integer-processing
- Run the script:
python data-lab1.py
The script prompts the user to enter the number of elements (n
). It then generates n
random integers within the range [1, 5], multiplies each integer by 4, filters the resulting list to include only elements greater than 10, and finally calculates and prints the sum of these elements.
Enter the number of elements (n): 5
Initial list: [3, 1, 4, 2, 5]
List after multiplying by 4: [12, 4, 16, 8, 20]
Sum of elements greater than 10: 48