Double Every Value

This kind of transformation is common when you need to apply one rule to every item in a list, like doubling all values. Write maps, which takes a list of numbers x and returns a new list. In the new list, each element should be the matching original number multiplied by 2.

Примеры

Ввод
[1, 2, 3]
Вывод
[2, 4, 6]
Ввод
[4, 1, 1, 1, 4]
Вывод
[8, 2, 2, 2, 8]
Ввод
[2, 2, 2, 2, 2, 2]
Вывод
[4, 4, 4, 4, 4, 4]

Нужно реализовать

def maps(x: list[int]) -> list[int]:

Теги

arraylists
PostgreSQLv16

Här visas resultatet av din kod

Visible tests
1
Input
[1,2,3]
Expected[2,4,6]
2
Input
[4,1,1,1,4]
Expected[8,2,2,2,8]
3
Input
[2,2,2,2,2,2]
Expected[4,4,4,4,4,4]
4
Input
[]
Expected[]
5
Input
[0,-1]
Expected[0,-2]
6
Input
[1]
Expected[2]
Focus radio
Paused · SomaFM · Fluid