Remove None from the output of a function call
python, python-3.x
Solution
The reason this is happening to you is that you are printing the result of your function call, in this line here:
print(digits_plus(3))
But your function does not return any value, so it returns `None`. And `None` is being printed because you are telling Python to print it. (And it's on the same line as the rest because none of your other `print`s print a newline.) To solve this, change that line to just:
digits_plus(3)
Your function is doing the printing, so there is no need to also print the function's return value.
(You could also revise your function to return the desired value instead of printing it, which would make it more generally useful.)
Problem
``` def digits_plus(num): for i in range (num+1): print (str(i)+"+",end="") print (digits_plus(3)) ``` Here's what I got returned: ``` 0+1+2+3+None ``` "None" always exists at the last of the line returned. I want this returned: ``` 0+1+2+3+ ``` BTW. I'm totally new to programming.I did some research myself, but the answers weren't helpful. They all tell me to remove `print` but I want the string in the same line so I must also include `end=""`. Help please.