Hi to everyone. I am absolute new in programming and Python. A started to learn it with one textbook, and one of the first exercises was printing multiple lines with triple quotes. And here the strange thing comes: the word "game" is printed normally, the word "over" is not printed normally. Why is it? How can I fix it? Thank you for your answers.
For words see the picture:
![[Image: f04518a59afafef73130dc95c7b84690-full.png]](https://cdn1.imggmi.com/uploads/2019/5/30/f04518a59afafef73130dc95c7b84690-full.png)
For words, please copy and paste. Use
BBCode tags to format code or output.
Here is the code:
print("Program 'Game Over' 2.0")
print('''
__________ _______ ____ _____ ___________
/ | / | / | / | | |
/ _______| / _ | / |/ | | _______|
| | / / | | / /| /| | | |
| | / /__| | / /| / | | | |_____
| | ___ / ____ | / / |___/ | | | _____|
| | | | / / | | / / | | | |
| |___| | / / | | / / | | | |_______
\ / / / | | / / | | | |
\_______/ /___/ |___| /___/ |___| |___________|
_________ ___ ___ ___________ _______
/ \ | | / / | | | \
/ _ \ | | / / | _______| | |\ \
| / \ | | | / / | | | | \ \
| | | | | | / / | |_____ | |_/ /
| | | | | | / / | _____| | /
| | | | | | / / | | | |\ \
| \_/ | | |/ / | |_______ | | \ \
\ / | / | | | | \ \
\_________/ |______/ |___________| |___| \___\
''')
In this message the output seems to be correct (therefore I didn't put it here), but in Spider and in the console it is not. Why?
In Python strings, the backslash "\" is a special character, also called the "escape" character. It is used in representing certain whitespace characters: "\t" is a tab, "\n" is a newline, and "\r" is a carriage return.
Put an r in front of the string to make it a raw string it will then treat the "\" as normal "\".
print("Program 'Game Over' 2.0")
print(r'''
__________ _______ ____ _____ ___________
/ | / | / | / | | |
/ _______| / _ | / |/ | | _______|
| | / / | | / /| /| | | |
| | / /__| | / /| / | | | |_____
| | ___ / ____ | / / |___/ | | | _____|
| | | | / / | | / / | | | |
| |___| | / / | | / / | | | |_______
\ / / / | | / / | | | |
\_______/ /___/ |___| /___/ |___| |___________|
_________ ___ ___ ___________ _______
/ \ | | / / | | | \
/ _ \ | | / / | _______| | |\ \
| / \ | | | / / | | | | \ \
| | | | | | / / | |_____ | |_/ /
| | | | | | / / | _____| | /
| | | | | | / / | | | |\ \
| \_/ | | |/ / | |_______ | | \ \
\ / | / | | | | \ \
\_________/ |______/ |___________| |___| \___\
''')
Another option is to use double "\\"
print("Program 'Game Over' 2.0")
print('''
__________ _______ ____ _____ ___________
/ | / | / | / | | |
/ _______| / _ | / |/ | | _______|
| | / / | | / /| /| | | |
| | / /__| | / /| / | | | |_____
| | ___ / ____ | / / |___/ | | | _____|
| | | | / / | | / / | | | |
| |___| | / / | | / / | | | |_______
\ / / / | | / / | | | |
\_______/ /___/ |___| /___/ |___| |___________|
_________ ___ ___ ___________ _______
/ \ | | / / | | | \\
/ _ \ | | / / | _______| | |\ \\
| / \ | | | / / | | | | \ \\
| | | | | | / / | |_____ | |_/ /
| | | | | | / / | _____| | /
| | | | | | / / | | | |\ \\
| \_/ | | |/ / | |_______ | | \ \\
\ / | / | | | | \ \\
\_________/ |______/ |___________| |___| \___\\
''')
An extra blank space in place of the doubled "\" will also work
Thank you very much, I understood the problem.