What should I do to get the price like this?

Asked 2 years ago, Updated 2 years ago, 18 views

def times2(k):

    k[?] = k[?] * 2
    k[?] = k[?] * 2

a = [1, 2]

b = [3, 4]

times2(a)

times2(b)

print('a = ', a, 'b = ', b)

I wonder what's in the 2nd or 3rd row?
The resulting value should be a = [2, 4] b = [6, 8]
I'd appreciate your help.

python

2022-09-20 10:56

1 Answers

https://www.geeksforgeeks.org/python-change-list-item/

Search keyword: python list reassign


2022-09-20 10:56

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.