How to change values in the list without creating a new list?
📁 python, работа
The standard method through the list inclusion (
My_LIST = [ 1 , 2 , 3 , 4 5 , 6 ] my_list_1 = [i* 5 for i in my_list] Print (my_list_1) Why I can not do with the source list:
My_List = [ 1 , 2 , 3 , 4 , 5 , 6 ] for i in my_list: i*= 5 print (my_list) Сode> this code does not work, why?
Ответов пока нет.
Войдите чтобы оставить ответ