LEARNING OBJECTIVES
Learn how to write code in Python script
mode.
LEARNING OUTCOMES
I can save code in Python’s script mode...
I can get keyboard input from users...
[ slide 3 ]
STARTER
Up until now we have not saved any files. We have
worked in interactive mode.
We can also save and run files too – in script mode.
To open a new script mode window:
1. Open IDLE and then from the File menu choose New
Window
2. To save this file choose Save from the File menu.
Lesson outcomes:
 I can save code in Python’s script
mode...
 I can get keyboard input from
users...
[ slide 6 ]
#COMMENTING
#Comments are used in Python to indicate what some part of the
code does.
#Comments always appear in red.
Lesson outcomes:
 I can save code in Python’s script
mode...
 I can get keyboard input from
users...
[ slide 1 ]
MAIN TASK 1
1. Log in to your computer
2. Open Python IDLE
3. Copy the code below to get the program to count to 10
>>> number=1
>>> while number < 11:
print(number)
number = number+1
4. Now in interactive mode, re-write the code so it prints the first 10 square
numbers e.g. 1, 4, 9, 16, 25, 36 ...
Don’t forget to add #Comments to indicate what the code does.
Lesson outcomes:
 I can save code in Python’s script
mode...
 I can get keyboard input from
users...
MINI PLENARY
Feedback your solution to the
rest of the class.
Lesson outcomes:
 I can save code in Python’s script
mode...
 I can get keyboard input from
users...
[ slide 9 ]
MAIN TASK 2
Write a Python file called friendly_computer.py
When run it should:
 ask the user for their name and store it in a variable
 say Hello to the user using the user’s name
 tell the user that it was nice talking to them
 say “Bye [name]”
Hint: You have done most of this in interactive mode.
Do not forget to save your file and send it to your teacher.
Lesson outcomes:
 I can save code in Python’s script
mode...
 I can get keyboard input from
users...
PLENARY
Why add a comment to the beginning of your
code?
In which two modes can you write code in
Python?
Don’t forget to upload your work to Moodle.
Lesson outcomes:
 I can save code in Python’s script
mode...
 I can get keyboard input from
users...

Year 7 lesson 4 interactive and script mode

  • 2.
    LEARNING OBJECTIVES Learn howto write code in Python script mode.
  • 3.
    LEARNING OUTCOMES I cansave code in Python’s script mode... I can get keyboard input from users...
  • 4.
    [ slide 3] STARTER Up until now we have not saved any files. We have worked in interactive mode. We can also save and run files too – in script mode. To open a new script mode window: 1. Open IDLE and then from the File menu choose New Window 2. To save this file choose Save from the File menu. Lesson outcomes:  I can save code in Python’s script mode...  I can get keyboard input from users...
  • 5.
    [ slide 6] #COMMENTING #Comments are used in Python to indicate what some part of the code does. #Comments always appear in red. Lesson outcomes:  I can save code in Python’s script mode...  I can get keyboard input from users...
  • 6.
    [ slide 1] MAIN TASK 1 1. Log in to your computer 2. Open Python IDLE 3. Copy the code below to get the program to count to 10 >>> number=1 >>> while number < 11: print(number) number = number+1 4. Now in interactive mode, re-write the code so it prints the first 10 square numbers e.g. 1, 4, 9, 16, 25, 36 ... Don’t forget to add #Comments to indicate what the code does. Lesson outcomes:  I can save code in Python’s script mode...  I can get keyboard input from users...
  • 7.
    MINI PLENARY Feedback yoursolution to the rest of the class. Lesson outcomes:  I can save code in Python’s script mode...  I can get keyboard input from users...
  • 8.
    [ slide 9] MAIN TASK 2 Write a Python file called friendly_computer.py When run it should:  ask the user for their name and store it in a variable  say Hello to the user using the user’s name  tell the user that it was nice talking to them  say “Bye [name]” Hint: You have done most of this in interactive mode. Do not forget to save your file and send it to your teacher. Lesson outcomes:  I can save code in Python’s script mode...  I can get keyboard input from users...
  • 9.
    PLENARY Why add acomment to the beginning of your code? In which two modes can you write code in Python? Don’t forget to upload your work to Moodle. Lesson outcomes:  I can save code in Python’s script mode...  I can get keyboard input from users...