+ 5
Python Problem: reset an element of a list by two other elements
I came across this problem when trying a challange: Given a list [4,1 ] reset the first element of the list by all members of the list [3,1] --> [3,1,1] after by the list[2,2] --> [2,2,1] did not yet find an elegant solution
5 Antworten
+ 2
I don't know if this looks elegant. This came natural.
a = [4, 1]
b = [2, 2]
c = [3, 5]
print(b+a[1:])
print(c+a[1:])
+ 6
given a List A [4,1]
given a List B [2,2]
given a List C [1,3]
from List A reset first Element by all Elements of List B --> [2,2,1]
then from original List A reset first Element by all Elements of List C --> [1,3,1]
looking for an elegant solution.
+ 5
yes it is!
+ 3
@ravi it helped me a lot . thank you
+ 1
I did not quite understand your question. How do you reset the first element with all members?