A Letter to Your Principal¶

Write a program that displays your school principal’s name and address on the screen as if it were a letter. Your output should look something like the text below.

Name the file:

letter_to_principal.py

+---------------------------------------------------------+
|                                                    #### |
|                                                    #### |
|                                                    #### |
|                                                         |
|                    Mr. Servidio                         |
|                    St. Robert CHS                       |
|                    8101 Leslie St                       |
|                    Thornhill, ON                        |
|                    L3T 7P4                              |
|                                                         |
+---------------------------------------------------------+

Frequently-Asked Questions¶

  • Does my letter have to look exactly like yours?

    • No, but it does have to look roughly like a letter, including the box around the outside and the stamp.

  • How to I get a | to show up on the screen?

    • The | character is called a “pipe”. Assuming you are using a normal US keyboard, it is Shift + backslash (\). The backslash key is usually located between the Backspace and Enter keys.

  • Why doesn’t my letter line up when I run the program?!? Everything looks perfect in the code!

    • You probably used a mixture of tabs and spaces between the quotes in your print() functions. Many text editors / IDEs will only move the cursor 4 spaces when you press TAB. But when your program runs, any tabs embedded inside the quotes will take up 8 spaces, not 4. If you delete ALL the tabs between the quotes and replace them with spaces, things should look the same in your code and when you run the program.


©2021 Daniel Gallo

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

Creative Commons License

Adapted for Python from Graham Mitchell’s Programming By Doing