4 ms·
You can use variables in the formats. >>> flt = 1.2345 >>> two = 2 >>> f"{flt:.{two}f}" '1.23'
by eljost 6y ago
You can use variables in the formats.
>>> flt = 1.2345
>>> two = 2
>>> f"{flt:.{two}f}"
'1.23'
- thaumasiotes 6y agoThat is the opposite of the problem being posed. The question is how you define `greet` using f-strings.
- sumzup 6y agogreet = lambda x: f"hello {x}"