Double the List

Write a function maps that takes a list of integers a and returns a new list where each element is the original number multiplied by 2. For an empty list, return an empty list. An empty list [] and the append method inside a loop will help.

Примеры

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

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

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

Теги

listsarray
PostgreSQLv16

Her vises resultatet af din kode

Tests12
Visible tests
Skjult test 7
Skjult test 8
Skjult test 9
Skjult test 10
Skjult test 11
Skjult test 12

They run when you press "Submit" — your whole solution is checked against them so you can't hard-code answers for the visible cases.

Focus radio
Paused · SomaFM · Fluid