You're almost there. What you've failed to do (because you're new to Python, for which you don't need to be sorry) is to pass an argument to your function.
Hint:
def Q9(n): # n is an arbitrary variable name for i in range(n): print(i) Q9(5)That will produce an output of:
Output:0
1
2
3
4
Now, it is possible to produce:Output:0 1 2 3 4
... with a simple alteration to the print()
function. It's your task to look into what options you can use with said function and post back your solution.Hint:
>>> help(print)
Sig:
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein