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
Accedi per vedere la cronologia degli invii
AccediAccedi per usare l'AI Mentor
AccediTests12
Visible tests
Test nascosto 7
Test nascosto 8
Test nascosto 9
Test nascosto 10
Test nascosto 11
Test nascosto 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