Escape Artist

Create a new file called escape_artist.py. Manually type out the code below. Be extremely careful to type out each character correctly.

You may run the program after each line to ensure the line you typed is correct, otherwise it may be difficult to pinpoint a problem if one arises.

print("Hello, World!")
print("... umm 'hi'")
print('How\'s it going?')
print('whoa, single quotes too?')
print("Yes.", end=" ")
print("Either are fine to use.")
print("How did you..")
print()
print("\"put two prints on one line\"?")
print('what is the "\\" character for?')
print("To get \" characters in the output.")
print("Python won't consider it as ending a string.")
print('You can also use the other " character.')

Run the program and examine the output to compare how it matches up with the code. If you get an error, look very closely at each character and compare

Next step

Get the following string to output using print and the escape character (\):

When including quotes, " or ' in output..
you must use the escape character '\'.

If you want to use '\' in output,
you need to escape the escape character..
e.g., \\

Try to get this ASCII art to print out as well:

""\_('>')_/""

© 2021 Daniel Gallo

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.

Creative Commons License