Assessment for intruduction to python

Oct 2, 2014 • Sahar Rahmani

1) What does this code print?

print ‘My brother is’, int(‘6′)+3, ‘years’+’old’

a) My brother is 63 years old

b) My brother is 9 yearsold

c) My brother is 63 yearsold

d) My brother is 9 years old

 

2) In the following code how can we show one plus member of arrey x?

import numpy as np

x=np.arrey([1,2,3,4])

a) print x.shape+1

b) print x.shape+[1]

c) print x.shape[0]+1

d) print (x+1).shape