Error:f-string expression part cannot include a backslash
Why not just read the error message properly and code accordingly?And of course PEP8 and other coding standards are your friend.
from random import choice can_or_cant = choice(['can', 'can\'t']) sentence = f"never say you {can_or_cant} do something" print(sentence)Edit: OP question must be answered Yes, as this works without problems.
print(f"never say you can\'t do something")