Download Slides - Intro to Python File

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

Program optimization wikipedia , lookup

Falcon (programming language) wikipedia , lookup

Object-oriented programming wikipedia , lookup

Go (programming language) wikipedia , lookup

Subroutine wikipedia , lookup

Corecursion wikipedia , lookup

Algorithm wikipedia , lookup

Structured programming wikipedia , lookup

Algorithm characterizations wikipedia , lookup

Control flow wikipedia , lookup

String literal wikipedia , lookup

C Sharp (programming language) wikipedia , lookup

Python syntax and semantics wikipedia , lookup

Python (programming language) wikipedia , lookup

Transcript
Python
Lesson 1
An Introduction
What is Python?
Python is a
programming
language that is often
used to develop web
applications.
The creator of Python,
Guido van Rossum
named the language
after the 1970s BBC
Comedy series ‘Monty
Python’s Flying Circus’
Sequencing
The most simple type of program uses sequencing, a set of
instructions carried out one after another.
Start
Display
“Computer”
Display
“Science”
Display
“Rocks”
End
Flowcharts
Flowcharts are used to plan programs before they are created.
The start or end of the program. There may be more than one
way to complete the algorithm and there may be more than
one end box.
A process, that is doing something for example calculating
something.
An input or output, for example:
Input num1
A decision, YES or NO, or a choice of paths, for example:
Is it a weekday?
A subroutine or self-contained program that can be used as
required.
When a flowchart will not fit onto a single page we use this
shape to show how the sections of the flowchart connect
together.
Strings
In programming we usually call normal text a string.
A string is a
collection of
alphabetic and/or
numeric characters.
We tell the
computer
something is a string
by putting quote
marks around it.
“What’s your
name?”
Variables
When programming it is often necessary to store a value for use later
on in the program.
A variable is a label
given to a location in
memory containing a
value that can be
accessed or changed.
Think of a variable as a
box with a label that
you can store
information in.
Using Python
Match the Python code to the correct part of the flowchart.
Start
Display
“Computer”
Display
“Science”
Display
“Rocks”
End
Python
Open the Python 3.3 > IDLE Python GUI.
At the command line try typing in some of the following :
3+4
5/6
9*5
Print (‘hello’)
What happens?
Example
Match the Python code to the correct part of the flowchart.
Start
Input Name
Display “Hello
“ + name
End
Create a Python program based on the code above and
save it as variables.py. Press F5 to run it.
The Turing Test
Watch the video
The Turing Test
Click Here
Turing Test Simulator
Create your own Turing Test Simulator
Use variables and IF statements
Python Challenges
Now practice your sequencing skills by completing two of the Python
Challenges. Choose two from challenges 1 to 5.