Python Worksheet 1: Task Completed
Python Worksheet 1: Task Completed
Python worksheet 1
Task Completed
1 Open Idle on your computer. Idle is the program that allows you to write your
Python code.
windows
button.
2 The shell is used to type basic code. For instance, you can do some basic Maths
calculations. Type the following calculations followed by the enter key. Write the
answer next to each one.
a) 3*3
b) 48/3
c) 270 + 426
d) 155578 – 1234
e) 8 ** 2
You will see that each calculation takes the same time to complete and that we use different mathematical
operators for multiply and divide in Python than when we are doing Maths in our exercise books.
3 When we write our code in Idle we don’t usually use the shell. Instead we use the
editor. Open the editor on your computer.
Python
Python is its own language and it has its own syntax. This is the structure of
statements and words in that are used in Python. A bit like English has its own
structure of sentences and words and so do other languages such as Spanish or Urdu.
There are other computer programming languages such as Java or C++.
Chrdol72 Page 1 of 4
Name: Date:
Print statements
By using the print function, you can produce simple statements.
The print command here is colour coded. It is purple and that means it is part of the Python library.
Python functions are case-sensitive which means they
must always be in lower case (small letters). The
statement you wish to ‘output’ must be inside
opening and closing brackets and speech marks. If you have done this correctly, it will appear in
green.
4 Type the code shown above into your Idle editor and run the code.
Click F5 on the top row of your Click OK to save Your code will output in the
keyboard shell
Question Mark
1 What is the name of the program used to write Python code? 1
…………………………………………………………………………………………………………….
2 The following describes something important in programming: 1
b) syntax
c) variables
d) code
3 3
Mathematical Symbol
Operation
Addition +
Subtraction
Multiplication
Division
Fill in the missing symbols from the table above
…………………………………………………………………………………………………………….
6 What part of idle is used to do most of your coding? 1
a) The editor
b) The shell
c) The Python window
d) The file
Question Mark
7 What part of idle is shown here? 1
a) The editor
b) The shell
c) The Python window
d) The file
8 Which key is used to run your code? 1
Chrdol72 Page 3 of 4
Name: Date:
a) F4
b) F1
c) F5
d) Enter
9 When you run your code, what area of Idle does your code run in? 1
a) The editor
b) The shell
c) The Python window
d) The file
10 2
There are 2 syntax errors in the code above. Describe what they are.
Error 1 ………………………………………………………………………………………………….
Error 2 ………………………………………………………………………………………………….
11 Is the following statement true or false? 1
Python functions are case-sensitive.
…………………………………………………………………………………………………………….
Chrdol72 Page 4 of 4