Having bit of trouble with a program i made. i am getting it to display a diamond but i have a problem, here is my code:
a = input("Enter width: ")
a = int(a)
b = a
for i in range(a):
i = i + 1
b = a - i
text = " " * b + " " + "* " * i
print(text[:-1])
for i in range(a):
i = i + 1
b = a - i
text = " " * i + " " + "* " * b
print(text[:-1])
Thanks for all the help! this is the answer
That's because
print
doesn't return the string, it returnsNone
.Perhaps you wanted to do this:
To remove the trailing white-space better use
str.rstrip
:help on
str.rstrip
: