In a script, numbers = [1, 2, 3]; new_numbers = [x * 10 for x in numbers]; print(new_numbers) is executed. What is the output?

  • [1, 1, 2, 2, 3, 3]
  • [1, 10, 2, 20, 3, 30]
  • [1, 2, 3, 1, 2, 3, 1, 2, 3]
  • [10, 20, 30]
The output is a list comprehension that multiplies each element in numbers by 10. Therefore, the result is [10, 20, 30].
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *