Question:
This is the code I’m using to make part of a text-based game:
I want to use textwrap to print the text without the words getting split at the end of a line, which works fine, but when I put a variable (armour) in the text it comes up with an error message:
Does anyone know how to fix this? I don’t want to use \n instead of textwrap due to different monitor sizes.
Answer:
In order to use variables in a string you have to use a
format
or
f
string.
more…
If you have better answer, please add a comment about this, thank you!