print ("The number is", (roll),'.')
The number is 5 .
I want to remove the space between '5' and '.'
I have tried a few different methods to remove the space before the period, but I am either getting errors or the same result.
print ("The number is", (roll),'.')
The number is 5 .
I want to remove the space between '5' and '.'
I have tried a few different methods to remove the space before the period, but I am either getting errors or the same result.
You need a string formatting method or concatenating methods. the follwoing will give you same results
print (f"The number is, {roll}.")
print ("The number is, {}.".format(roll))
print ("The number is"+' '+ str(roll) +'.')
print ("The number is %s. "%(a))
There are multiple solutions to your problem. I can recommend f-strings.
print ("The number is", (roll),'.')
becomes
print(f"The number is {roll}.")
There are multiple solutions to your question one of the solution you can do by using .format function.
print ("The number is {}.".format(roll))