We love coding and we love cats too! Combining our love for both, we have created a code art puzzle for you to solve using Python programming.
This is the code art that you will create:
Go to www.trinket.io and create a new ‘Python’ Trinket. Use these lines of code to get started.
print (“(\”) (\”)_/”)
print (” “)
Think about these as you try to solve this coding puzzle:
- Run the provided code. What output do you get? Observe.
- Can you map the output to the line of code that generated the output?
- Are the lines of code in the correct sequence? If not, how do the lines need to be moved around to get the output in the desired sequnce.
- Which line of code do you think needs to be modified? Why?
- What characters will you add on this line to generate the code art?
- Which order do the characters need to be in? Do you need to adjust the spacing?
Try to solve on your own, and refer to the below hints if needed.
- Move the lines of code around so the lines of code are in the correct sequence
- You will need to enter the correct characters within the red quotes
- Use these characters ( = ^ .
- You can simply hit space to add space before or after the characters within the quotes
print (” /\\___/\\”)
print (” (=^.^=)”)
print (” (\”) (\”)_/”)
print (” cat”)
The first, third and fourth lines of code were provided to you. You had to rearrange them to get them in the right order.
You had to add characters on the second line to get the eyes, nose and whiskers.
You had to add spaces before “cat” on the fourth line.
What did we learn?
- Python interpreter reads the code from top to bottom! Hence, the sequence of the lines of code is important.
- The characters within the quotes are printed as is, including the space. Hence, you had to adjust the spacing to print ‘cat’ centrally aligned with the code art.
Was it fun? Try creating more code art of your own!