print(f”The quotient of {num1} and {num2} is {num1/num2:.2f}”)
any variable or python expression can be inserted directly into {}
floating point formatting
print(f’{435:06.2f}’)
0 means fill the extra space with 0 (only allowed for numbers , if not specified defaults to spaces)
6 means the format should take 6 characters
.2 means 2 decimal point
f means number should be displayed as floating point number
string formatting
print(f’{“big long string”:>5.2s}’)
the > will format the string to the right
^ will centre the value in the centre of the window
5 is the output should take characters
.2 is use a maximum of 2 characters from the string
my_num = 9743
print(f’With commas: {my_num:,d}’)
a comma separating the thousands
d
for integer
g
for ‘optimate’ float notation