Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created January 19, 2021 06:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IndhumathyChelliah/82cc222a767cb1c19889c9ed9e68c043 to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/82cc222a767cb1c19889c9ed9e68c043 to your computer and use it in GitHub Desktop.
import numpy as np
a1=np.array([1,2,3])
a2=np.array([4,5,6])
print (a1+a2)
#Output:[5 7 9]
print (a1*3)
#Output:[3 6 9]
print (a1*a2)
#Output:[ 4 10 18]
b1=[1,2,3]
b2=[4,5,6]
#Concatenation
print (b1+b2)
#Output:[1, 2, 3, 4, 5, 6]
#Repetition
print (b1*3)
#Output:[1, 2, 3, 1, 2, 3, 1, 2, 3]
print (b1*b2)
#Output:TypeError: can't multiply sequence by non-int of type 'list'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment