f string options code example
Example 1: f string float format
>>> a = 10.1234
>>> f'{a:.2f}'
'10.12'
Example 2: python fstring
#python3.6 is required
age = 12
name = "Simon"
print(f"Hi! My name is {name} and I am {age} years old")
>>> a = 10.1234
>>> f'{a:.2f}'
'10.12'
#python3.6 is required
age = 12
name = "Simon"
print(f"Hi! My name is {name} and I am {age} years old")