Hi community. I’d like to share my solution to the Python Block Letters Exercise that uses more than just print()
. I ended up doing this because I was just revisiting the career path to tackle what was added, without really knowing what the learner was expected to know at that point. Also, I wanted to try out using a Codebyte.
The output of the codebyte doesn’t match the output in the exercise. So, here’s a snip showing the proper output:
To understand the code:
-
printrow
is a function that prints out a row of a letter. -
printascii
serves as the “main function”. It takes a list of letter coordinates and letter characters and prints them out side by side. It makes us ofprintrow
. - The position in the grid where each character will be inserted is defined for each letter.
- The ascii character of each letter, in the proper order, is defined as a list.
To add more letters, simply declare the positions of a new letter and then add the ascii character of that letter to char_list
.