Python Introduction
Python Introduction
Introduction
Task 1
Open Python, type the code below and press enter:
What happens?
print (Hello World)
Now write a program that writes your name on the screen.
Place a
screenshot of
your code
here.
Task 2
Open Python, type the code below and press enter:
What happens?
print (Hello * 10)
Now write a program that prints your name six times.
Place a
screenshot of
your code
here.
Task 3
Escape sequences can be used to alter how the information is
displayed on the screen.
print("\tQuestion what goes woof\t\tdogs\t\t\trabbits")
print("\n\nwhat kind of snake is good at maths?\n\nAn adder\n\n")
print("\n\nGoodbye\n\n")
Experiment with these escape sequences and complete the table.
Escape sequence Effect
\t
\n
\\
\
\
Task 4
Print this text using just one line of code.
Help, I need somebody
Help, not just anybody
Help, you know, I need someone
Place a
screenshot of
your code
here.
Task 5
Write a program using print commands to display your initials five
characters high on the screen.
X X X X
XX X X X
X X X XXXXXX
X XX X X
X X X X
Place a
screenshot of
your code
here.
Task 6
Copy and run these lines of code. Complete the table to explain
what the mathematical operators do.
>>> 60/5
>>> 987+34
>>> 564*89
>>> 2**5
>>> 43-5
>>> 11//2
>>> 11%2
Mathematical operator Operation
/
+
*
**
-
//
%
Task 7
Copy and run these lines of code.
>>> 5 * 3 / 6 + 4
>>>(5 * 3) / (6 + 4)
15 / 2 * 3 + 2
What effect do the
parentheses () have?
Predict what you think
will happen when the
line of code above is
executed.