Homework 3

Send your homework as a single ZIP archive with your files, or send a link to your GitHub repo. Try to keep line lengths below 80 characters.

EXERCISE 3.1


For a given word (you may use your name), print it in squares.
If word = "Python", then the result is
+---+---+---+---+---+---+
| P | y | t | h | o | n |
+---+---+---+---+---+---+

EXERCISE 3.2


Make a loop over integer numbers from 1 to 40.
If x is divided by 5 then print a message 'x is divided by 5'.
If x is divided by 7 then print a message 'x is divided by 7'.
If x is divided by 5 and 7 then print a message 'x is divided by 5 and 7'.
Skip x = 13.
If x is not divided by 5 and x is not divided by 7 
then print a message 'x is not important'.
Prepare two solutions with 'while' and 'for' loops.

EXERCISE 3.3


Create the following variables:
n = 2022
x = math.pi   # save with 5 digits after a dot (import 'math' first!)
word = "Python"
polish = "książka"   # 'book' in English
Write the variables to a text file "vars.txt",
one line for one variable.
Print the file content on the screen.