That's because print
doesn't return the string, it returns None
.
>>> print(print("foo"))
foo
None
Perhaps you wanted to do this:
text = " " * i + " " + "* " * b
print (text[:-1])
To remove the trailing white-space better use str.rstrip
:
>>> "foo ".rstrip()
'foo'
help on str.rstrip
:
>>> print (str.rstrip.__doc__)
S.rstrip([chars]) -> str
Return a copy of the string S with trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.