Homework 6. numpy

Here you can find the solution of the homework 6 of the 'Herramientas computacionales' course at uniades (Section 6) Course, Homework.

We have created two different modules with functions with the same names, but different results, on this notebook we will see the difference,

First, let us import them with different alias.

In [1]:
import mod1 as m1
import mod2 as m2
In [2]:
print(dir(m1),dir(m2))

There are the functions Fib and Sum with the same names on both modules.

Sum function

On the case of the first module, the function Sum return a string result of summing the string-converted parametersm

In [3]:
print(type(m1.Sum(1.,2.)),m1.Sum(1.,2.))

While on the second file, it converts to int and return the sum

In [4]:
print(type(m2.Sum(1.,2.)),m2.Sum(1.,2.))
<class 'int'> 3

Fibfunction This function on the first case returns the $n^{\text{th}}$ number of the Fibonacci recursion while on the second returns a list including the previous.

In [5]:
m1.Fib(10)
Out[5]:
55
In [6]:
m2.Fib(10)
Out[6]:
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]