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
Inicia sesión para ver tu historial de envíos
Iniciar sesiónInicia sesión para usar el AI Mentor
Iniciar sesiónTests12
Visible tests
Prueba oculta 7
Prueba oculta 8
Prueba oculta 9
Prueba oculta 10
Prueba oculta 11
Prueba oculta 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