For example:
edad = 18
print("Tengo %d años) % edad
According to what they told me, I had to formulate it like this but I'm getting this error:
TypeError: unsupported operand type (s) for%: 'NoneType' and 'int'
For example:
edad = 18
print("Tengo %d años) % edad
According to what they told me, I had to formulate it like this but I'm getting this error:
TypeError: unsupported operand type (s) for%: 'NoneType' and 'int'
The syntax is
edad = 18
print("tengo %d años" % edad)
And it does work in python3.
In Python 3.x the use of% is no longer allowed.
Edit
In link I read
A new system for built-in string formatting operations replaces the% string formatting operator. (However, the% operator is still supported; it will be deprecated in Python 3.1 and removed from the language at some later time.) Read PEP 3101 for the full scoop.
End
You must use .format.
For example in your case:
edad=18
frase="Tengo {} años".format(edad)
print(frase)