inner  

The inner tool returns the inner product of two arrays.

import numpy

A = numpy.array([0, 1])
B = numpy.array([3, 4])

print numpy.inner(A, B)     #Output : 4

outer    

The outer tool returns the outer product of two arrays.

import numpy

A = numpy.array([0, 1])
B = numpy.array([3, 4])

print numpy.outer(A, B)     #Output : [[0 0]
                            #          [3 4]]

Task  

You are given two arrays: $\mbox{A}$ and $\mbox{B}$. 

Your task is to compute their inner and outer product.

Input Format

The first line contains the space separated elements of array $\mbox{A}$. 

The second line contains the space separated elements of array $\mbox{B}$.

Output Format

First, print the inner product. 

Second, print the outer product.

Sample Input
0 1
2 3

Sample Output
3
[[0 0]
 [2 3]]

Difficulty: EASY

Solutions:
import numpy
arr1 = numpy.array([list(map(int, input().split()))])
arr2 = numpy.array([list(map(int, input().split()))])
print(numpy.inner(arr1, arr2)[0][0])
print(numpy.outer(arr1, arr2))


import numpy as np
la = input().split()
lb = input().split()
a = np.array(la, int)
b = np.array(lb, int)
print(np.inner(a, b))
print(np.outer(a, b))


import numpy as np
import sys
A = np.array(sys.stdin.readline().split(), int)
B = np.array(sys.stdin.readline().split(), int)
print(np.inner(A, B))
print(np.outer(A, B))


import numpy
a = numpy.array(input().split(), int)
b = numpy.array(input().split(), int)
print(numpy.inner(a, b), numpy.outer(a, b), sep='\n')


import numpy
a = numpy.array([int(x) for x in input().split()])
b = numpy.array([int(x) for x in input().split()])
print(numpy.inner(a, b))
print(numpy.outer(a, b))


import sys
import numpy as np
a_list = []
b_list = []
a_list.append([int(x) for x in input().split()])
b_list.append([int(x) for x in input().split()])
a_array = np.array(a_list, dtype=int)
b_array = np.array(b_list, dtype=int)
print(int(np.inner(a_array, b_array)))
print(np.outer(a_array, b_array))


import numpy as np
arr1 = np.array([int(x) for x in input().split(' ')])
arr2 = np.array([int(x) for x in input().split(' ')])
print(np.inner(arr1, arr2))
print(np.outer(arr1, arr2))


import numpy as np
a = np.array([int(x) for x in input().split(' ')])
b = np.array([int(x) for x in input().split(' ')])
print(np.inner(a, b))
print(np.outer(a, b))


import numpy
arrs = [list(map(int, input().strip().split())) for _ in range(2)]
print(numpy.inner(*arrs))
print(numpy.outer(*arrs))


import numpy as np
(a, b) = (np.array(list(map(int, input().split()))), np.array(list(map(int, input().split()))))
print(np.inner(a, b), np.outer(a, b), sep='\n')


import numpy
a = numpy.array([list(map(int, input().split()))])
b = numpy.array([list(map(int, input().split()))])
print(*list(map(int, numpy.inner(a, b))))
print(numpy.outer(a, b))


import numpy as np
arr1 = np.array(list(map(int, input().strip().split())))
arr2 = np.array(list(map(int, input().strip().split())))
print(np.inner(arr1, arr2))
print(np.outer(arr1, arr2))


import numpy
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
a1 = numpy.array(arr1, int)
a2 = numpy.array(arr2, int)
print(numpy.inner(a1, a2))
print(numpy.outer(a1, a2))


import numpy
arra = numpy.array(list(input().split()), int)
arrb = numpy.array(list(input().split()), int)
print(numpy.inner(arra, arrb))
print(numpy.outer(arra, arrb))


import numpy
a = numpy.array([list(map(int, input().split())) for i in range(1)])
b = numpy.array([list(map(int, input().split())) for i in range(1)])
print(numpy.inner(a, b)[0][0])
print(numpy.outer(a, b))


import numpy
a = numpy.array([i for i in map(int, input().split())])
b = numpy.array([i for i in map(int, input().split())])
print(numpy.inner(a, b))
print(numpy.outer(a, b))


from numpy import array, inner, outer
(A, B) = (array(list(map(int, input().strip().split()))) for _ in range(2))
print(inner(A, B))
print(outer(A, B))


import numpy as np
a = np.array(list(map(int, input().split())))
b = np.array(list(map(int, input().split())))
print(np.inner(a, b))
print(np.outer(a, b))


import numpy
a = numpy.array(input().split(), int)
b = numpy.array(input().split(), int)
print(numpy.inner(a, b))
print(numpy.outer(a, b))


import numpy
a = numpy.array(list(map(int, input().strip().split())))
b = numpy.array(list(map(int, input().strip().split())))
print(numpy.inner(a, b))
print(numpy.outer(a, b))


import numpy
arr1 = numpy.array([a for a in input().split()], int)
arr2 = numpy.array([a for a in input().split()], int)
print(numpy.inner(arr1, arr2), numpy.outer(arr1, arr2), sep='\n')


import numpy
L = [numpy.array(input().split(), int) for _ in range(2)]
print(numpy.inner(*L), numpy.outer(*L), sep='\n')


import numpy
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A = numpy.array(A, int)
B = numpy.array(B, int)
print(numpy.inner(A, B))
print(numpy.outer(A, B))


import numpy
A = numpy.array(list(map(int, input().split())))
B = numpy.array(list(map(int, input().split())))
print(numpy.inner(A, B))
print(numpy.outer(A, B))


import numpy as np
a = np.array(input().split(), int)
b = np.array(input().split(), int)
print(np.inner(a, b))
print(np.outer(a, b))


import numpy
a = numpy.array(list(map(int, input().split())))
b = numpy.array(list(map(int, input().split())))
print(numpy.inner(a, b))
print(numpy.outer(a, b))


import numpy
a = numpy.array(tuple(input().split()), int)
b = numpy.array(tuple(input().split()), int)
print(numpy.inner(a, b), numpy.outer(a, b), sep='\n')


import numpy
array_a = list(map(int, input().split()))
array_b = list(map(int, input().split()))
print(numpy.inner(array_a, array_b))
print(numpy.outer(array_a, array_b))


import numpy as np
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(a, b) = (np.array(a), np.array(b))
print(np.inner(a, b))
print(np.outer(a, b))


import numpy as np
a = np.array([int(i) for i in input().split()])
b = np.array([int(i) for i in input().split()])
print(np.inner(a, b))
print(np.outer(a, b))


import numpy as np
A = np.array(list(map(int, input().split())))
B = np.array(list(map(int, input().split())))
print(np.inner(A, B))
print(np.outer(A, B))


import numpy
A = numpy.array([int(x) for x in input().split()])
B = numpy.array([int(x) for x in input().split()])
print(numpy.inner(A, B))
print(numpy.outer(A, B))


import numpy
mojir = input()
hyo = mojir.split(' ')
motoarra = [int(mono) for mono in hyo]
arra = numpy.array(motoarra)
mojir = input()
hyo = mojir.split(' ')
motoarrb = [int(mono) for mono in hyo]
arrb = numpy.array(motoarrb)
print(numpy.inner(arra, arrb))
print(numpy.outer(arra, arrb))


import numpy
np_ar1 = numpy.array(list(map(int, input().split())))
np_ar2 = numpy.array(list(map(int, input().split())))
print(numpy.inner(np_ar1, np_ar2))
print(numpy.outer(np_ar1, np_ar2))


import numpy
A = list(map(int, input().split()))
B = list(map(int, input().split()))
print(numpy.inner(numpy.array(A), numpy.array(B)))
print(numpy.outer(numpy.array(A), numpy.array(B)))


import numpy as np
a = np.array(list(map(lambda x: int(x), input().split())))
b = np.array(list(map(lambda x: int(x), input().split())))
print(np.inner(a, b))
print(np.outer(a, b))


import numpy as np
a = np.array(input().strip().split(' '), int)
b = np.array(input().strip().split(' '), int)
print(np.inner(a, b))
print(np.outer(a, b))


import numpy
A = [int(i) for i in input().strip().split()]
B = [int(i) for i in input().strip().split()]
print(numpy.inner(A, B))
print(numpy.outer(A, B))


import numpy
A = numpy.array(input().strip().split(), int)
B = numpy.array(input().strip().split(), int)
print(numpy.inner(A, B))
print(numpy.outer(A, B))


import numpy as np
a = np.fromstring(input(), sep=' ', dtype=int)
b = np.fromstring(input(), sep=' ', dtype=int)
print(np.inner(a, b))
print(np.outer(a, b))


import numpy
arr1 = numpy.array([int(e) for e in input().split()], dtype=int)
arr2 = numpy.array([int(e) for e in input().split()], dtype=int)
print(numpy.inner(arr1, arr2))
print(numpy.outer(arr1, arr2))


import numpy
A = numpy.array(list(map(int, input().strip().split())))
B = numpy.array(list(map(int, input().strip().split())))
print(numpy.inner(A, B))
print(numpy.outer(A, B))


import numpy
(A, B) = (numpy.array(list(map(int, input().split()))), numpy.array(list(map(int, input().split()))))
print(numpy.inner(A, B), numpy.outer(A, B), sep='\n')


import numpy
(A, B) = [numpy.array(input().split(), int) for _ in range(2)]
print(numpy.inner(A, B), numpy.outer(A, B), sep='\n')


import numpy
arrA = numpy.array([int(x) for x in input().strip().split()])
arrB = numpy.array([int(x) for x in input().strip().split()])
print(numpy.inner(arrA, arrB))
print(numpy.outer(arrA, arrB))


import numpy
a = list(map(int, input().strip().split()))
b = list(map(int, input().strip().split()))
print(numpy.inner(a, b))
print(numpy.outer(a, b))


import numpy
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a = numpy.array(a)
b = numpy.array(b)
print(numpy.inner(a, b))
print(numpy.outer(a, b))


import numpy
a = [int(e) for e in input().split()]
b = [int(e) for e in input().split()]
print(numpy.inner(a, b))
print(numpy.outer(a, b))


import numpy
A = list(map(int, input().split()))
B = list(map(int, input().split()))
print(numpy.inner(A, B))
print(numpy.outer(A, B))


import numpy
A = numpy.array([int(x) for x in input().strip().split()])
B = numpy.array([int(x) for x in input().strip().split()])
print(numpy.inner(A, B))
print(numpy.outer(A, B))


import numpy
arr1 = []
arr2 = []
arr1 = [int(x) for x in input().split()]
arr2 = [int(x) for x in input().split()]
my_array1 = numpy.array(arr1)
my_array2 = numpy.array(arr2)
print(numpy.inner(my_array1, my_array2))
print(numpy.outer(my_array1, my_array2))


import numpy as np
inp = input()
matrix1 = np.array(list(map(int, inp.split())))
inp = input()
matrix2 = np.array(list(map(int, inp.split())))
result1 = np.inner(matrix1, matrix2)
result2 = np.outer(matrix1, matrix2)
print(result1)
print(result2)


import numpy as np
A = np.array(list(map(int, input().split(' '))))
B = np.array(list(map(int, input().split(' '))))
print(np.inner(A, B))
print(np.outer(A, B))


import numpy as np

def main():
	a = np.array(input().split(), int)
	b = np.array(input().split(), int)
	print(np.inner(a, b))
	print(np.outer(a, b))
main()


import sys
import numpy as np

def main():
	f = open(sys.argv[1], 'r') if len(sys.argv) > 1 else sys.stdin
	A = np.array([int(i) for i in f.readline().split()])
	B = np.array([int(i) for i in f.readline().split()])
	print(np.inner(A, B))
	print(np.outer(A, B))
	if f != sys.stdin:
		f.close()
main()


import numpy
a = numpy.array(input().split(' '), int)
b = numpy.array(input().split(' '), int)
print(numpy.inner(a, b))
print(numpy.outer(a, b))


import numpy
import numpy
a = numpy.array(input().split(), int)
b = numpy.array(input().split(), int)
print(numpy.inner(a, b))
print(numpy.outer(a, b))


import numpy as np
npArr1 = np.array(list(map(int, input().split())))
npArr2 = np.array(list(map(int, input().split())))
print(np.inner(npArr1, npArr2))
print(np.outer(npArr1, npArr2))


import numpy
A = numpy.array(input().split(), int)
B = numpy.array(input().split(), int)
print(numpy.inner(A, B))
print(numpy.outer(A, B))


import numpy
(arr1, arr2) = (numpy.array(list(map(int, input().strip().split()))), numpy.array(list(map(int, input().strip().split()))))
print(numpy.inner(arr1, arr2))
print(numpy.outer(arr1, arr2))


import operator
import numpy

def read_f(f):
	return f(input())

def read_f_words(f):
	return mapl(f, input().split())

def mapl(f, x):
	return list(map(f, list(x)))

def read_a(f, n):
	ns = []
	for x in range(n):
		ns.append(read_f_words(f))
	return numpy.array(ns, f)
n = 1
a = read_a(int, n)
b = read_a(int, n)
print(numpy.inner(a, b).flatten()[0])
print(numpy.outer(a, b))


import numpy as np
arr1 = np.array(input().split(), dtype=int)
arr2 = np.array(input().split(), dtype=int)
print(np.inner(arr1, arr2))
print(np.outer(arr1, arr2))