Download Introduction to Python

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Introduction to Python
Python is a programming language.
How confident are you that you could write
multiple computer programs in Python?
5
Extremely
Confident
1
Not
Confident
Learning Outcomes
LO1 Be able to describe what Python is.
LO2 Create programs in Python.
LO3 Use a variable in a program.
Video goes here!
Today we will learn to write programs in
Python
Python is a programming language.
A programming language lets us type in instructions called
programming code. The computer then runs these
instructions. These instructions are what we call a computer
program.
Activity 1: Paired
Syntax
In a computer program what we type must be in the correct
order for the computer to understand or it will not work.
print ( “ Hello World ” )
Activity 2: Individual
What do the different parts of the program actually mean?
This opens the
statement.
This indicates
opening of the text
that will appear on
the screen.
This indicates the
close of the text that
will appear on the
screen.
print ( “ Hello World ” )
Indicates you
want something
to appear on the
screen when you
run the program.
This is what will
appear on the
screen when you
run the program.
This closes the
statement.
Your now ready to write your first program
using Python!
Lets get started
-Open the Python program
-You will now have the shell open this is where the program
will run when we test it.
-We need to write and save our
programs in a new window.
-Save your first program as
hello.py
Hint: to run a press F5 to select run
(the program must be saved first).
When saving a program, you need to
remember to put .py at the end of
the file name.
Activity
Create a program that will tell me:
 You are learning to program in Python.
 What your name is.
 How old you are.
 What your favourite hobby is.
 What your favourite colour is.
 What your favourite subject is at school.
 What your favourite food is.
Save as me.py
What’s a Variable?
Something that can change
This what we call the
variable, it holds data
while a program is
running.
Means the user can
input data and store it
in the variable.
name= raw_input (“What is your name?”)
print ( “Hello” +name )
Activity
Writing programs that use the user input.
Plenary
How confident are you that you could write
multiple computer programs in Python?
5
Extremely
Confident
1
Not
Confident