How to perform action on a integer placeholder in python?
You can do this with f-strings in Python 3.6+.
name = "Joe"
age = 42
print(f'{name} is {age + 10} years old')
String formatting insert values into a string. To operate on a value you should compute the value first and then insert/format it into the string.
print('%s is %d years old' % ('Joe', 42 + 10)
# or if you really want to something like that (python 3.6+)
name = 'joe'
age = 42
f'{name} is {age +10} years old'
You cannot do arithmetic operations inside a string.
print('%s is (%d) years old' % ('Joe', 42+10))