+ 2
How can I remove spaces between those braces and hyphen?
https://code.sololearn.com/c0tZBR9669I2/?ref=app In this code
3 Réponses
+ 5
Use a format string!
x = 5
print(f'({x})')
The {} are the spot where x is inserted, and the {} themselves are not printed, so you get:
(5)
You can also do it like this:
print('{}+{}={}'.format(2, 4, 2+4))
+ 4
use the sep keyword argument in print:
print(..., sep="") # no spaces between seperations
+ 3
As an alternate suggestion, use “+” signs to separate the different sections of your print statement rather than commas, e.g.,
print(“(“ + num[:10] + “)”)