I am unsure why I am getting this error
count=int(input ("How many donuts do you have?"))
if count <= 10:
print ("number of donuts: " ) +str(count)
else:
print ("Number of donuts: many")
In python3, print
is a function that returns None
. So, the line:
print ("number of donuts: " ) +str(count)
you have None + str(count)
.
What you probably want is to use string formatting:
print ("Number of donuts: {}".format(count))
Your parenthesis is in the wrong spot:
print ("number of donuts: " ) +str(count)
^
Move it here:
print ("number of donuts: " + str(count))
^
Or just use a comma:
print("number of donuts:", count)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With