0

list multiply

if you want to multiply the whole list by 3 what to do ex:Num(1,2,3,4) as input , if you want to multiply the list by two then op is 2,4,6,8

24th Jul 2016, 7:06 AM
Mayil esh
Mayil esh - avatar
4 Respuestas
+ 1
I would pop the things then reappend then to the list after multiplying or make a for loop multiplying then and putting in the list
24th Jul 2016, 7:42 AM
Caleb
0
to multiply the list you can use something like: multiplied_list = [i*2 for i in list] you can also use any other operation, not just multiplication
24th Jul 2016, 8:28 PM
RedAnt
RedAnt - avatar
0
do not do list*3... this will give u list, list, list
26th Nov 2016, 7:02 AM
Fadi Elrami
0
a = [1, 2, 3, 4] b = [5, 6, 7, 8] result = [num1*num2 for num1, num2 in zip(a,b)] print('Multiplication result is: ', result) You can read the full article here..... https://programmersportal.com/how-to-multiply-two-lists-in-JUMP_LINK__&&__python__&&__JUMP_LINK/
18th Oct 2021, 8:47 AM
Bhaskar Rana