Create a function generateNumbers(num) that takes in a positive number as argument and returns a list of number from 0 to that number inclusive. Note: The function range(5) will return a list of number [0, 1, 2, 3, 4].
Examples
>>> generateNumber(1)
[0, 1]
>>> generateNumber(10)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> generateNumber(0)
[0]
i dont know how to do this. i tried;
def num(num):
for x in range(num):
lis = []
lis.append(x)
y = x + 1
lis.append(y)
return lis
but it return the following;
num(10)
[0, 1]
previous attempts returned some weird results...
anyway, can you please advise me on this, or give me hints so i can advance my knowledge? would be much appreciated.