fork download
  1. # your code goes here
  2. import numpy
  3.  
  4. def mySquare(x):
  5. if isinstance(x, int):
  6. return x**2
  7. elif isinstance(x, range):
  8. return [i ** 2 for i in x]
  9.  
  10.  
  11.  
  12. print(mySquare(2));
  13. print(mySquare(range(10)));
  14. print(mySquare(numpy.zeros(10)));
Success #stdin #stdout 0.21s 26208KB
stdin
Standard input is empty
stdout
4
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
None