Unicode underline issue when executing python file

Viewed 95

Very new to python, so ignorance may be shown. (Python 3.10, Windows 10)

I have a simple code that tosses a coin. I want to underline the 'y' and 'n' in "yes" and "no" within this sentence: Do you want to flip another coin? yes or no.

I was able to make it work properly in IDLE, but it doesn't work properly when running in windows. The underline positions shifts to the left in Windows. I assume this is an issue in Windows, but can it be fixed? I'm simply double clicking the python file to run it in Windows, so maybe this is an incorrect way of doing it?

Here is the code for the sentence:

Yes = ('''es''')
No = ('''o''')
print('Do you want to flip another coin? ' + '\u0332y'+Yes + ' or' + ' \u0332n'+No)

Thanks for the help.

1 Answers

I have the solution, proof of work

follow the below code,

from prompt_toolkit import print_formatted_text, HTML
print_formatted_text('Do you want to flip another coin? ',HTML('<u>y</u>es'),'or',HTML('<u>n</u>o'))
Related