-2

suppose I have a list

a = [1,2,4,5]

I want to create another list b which clones a and adds it 3 times. So b is expected to be

b = [1,2,4,5,1,2,4,5,1,2,4,5]

How do I do this easily? Methods using pandas or numpy is also welcome.

martineau
  • 112,593
  • 23
  • 157
  • 280

1 Answers1

0
#just use the * operator
b=a*3
ibadia
  • 859
  • 6
  • 15