Python Programming - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

Python Programming

Description:

Python Programming Introduction to programming using python Objectives We re learning to develop basic code with the use of the correct syntax and variables. – PowerPoint PPT presentation

Number of Views:71
Avg rating:3.0/5.0
Slides: 15
Provided by: RC1
Category:

less

Transcript and Presenter's Notes

Title: Python Programming


1
Python Programming
  • Introduction to programming using python

2
  • Objectives
  • Were learning to develop basic code with the use
    of the correct syntax and variables.
  • Outcomes
  • Explain what syntax is and why its required.
  • Explain the use of variables.

3
What is a program?
  • An organized list of instructions that,
    when executed, causes the computer to behave in a
    predetermined manner. Without programs, computers
    are useless. Source Webopedia 2013
  • You can think of a program like a recipe.
  • It contains a list of ingredients called
    Variables.
  • You can store many different types of information
    in a variable such as
  • Data
  • Text
  • Images
  • A variable on its own is like a bucket.
  • You can get constant variables though

4
What is a program?
  • Open up python IDE and type in the following
  • Print (hello world)
  • What happens, when you press enter?

5
What is a program?
  • Open up python IDE and type in the following
  • Print (hello world)
  • What happens, when you press enter?

6
What is a program?
  • Open up python IDE and type in the following
  • 5 9
  • What happens, when you press enter?

7
What is a program?
  • Open up python IDE and type in the following
  • 5 9
  • What happens, when you press enter?

8
Syntax Errors
  • Within python, there are a number of operators
    and functions which are built into the language.
  • Youve just seen how it can handle number, do any
    other operators work? How do we subtract, divide
    or multiply. You give it a try!
  • Try printing other phrases, do they work?
  • Extension -
  • Now type out print (hello world)
  • What happens?

9
Syntax Errors
  • Extension -
  • Now type out print (hello world)
  • What happens?
  • SYNTAX ERROR
  • Like with English, programming languages have
    their own check similar to a grammar check. When
    you run code it checks to see whether it is in
    the form for the computer to compute. If you do
    not do this the computer throws out an error like
    above.

10
Using Variables
  • Variables are like a bucket, theyre used to
    store a number, data, text or image. You can
    empty it or refill it as many times as you like.
  • For example, to create a variable in python we
    might do the following
  • Studentname (James)
  • This now means that the word James is stored in
    student name. You can even print it to the screen
    by doing. Print (Studentname).

11
Using Variables
  • You can do the same with numbers, for example
  • Number1 10
  • Number2 20
  • Number3 20 10
  • Print (Number3)

12
Combine variables
  • You can do the same with numbers, for example
  • Using number3 you can combine your sentence with
    the text you stored in your variable. You could
    do the same with names or other values. Notice
    the Comma separating it.

13
Using Variables / Syntax
  • Independent Task
  • Using what you have learnt see if you can print
    screen and evidence the following for your
    teacher. You should evidence this by taking
    screen shots.
  • Show a syntax error and annotate it to explain
    it.
  • Show how to print text or numbers.
  • Show how to carry out calculations with numbers.
  • Show use of variables through either calculation
    or text.
  • See if you can make a sentence with the use of
    two variables.
  • Extension
  • Leading into next weeks lesson, you will have to
    know about different types of variables and data
    types. See if you can research the types
    available and examples of their use. You could
    really extend yourself by trying some of the
    code

14
Plenary
  • Self Assessment
  • Your teacher has issued you with a self
    assessment sheet. You will have todays objects
    and outcomes on it.
  • Task
  • Comment on the lesson. Talk about the positive
    experience you have had and talk about things you
    need a little more help on. If you managed to get
    onto the extension tasks, what have you found
    out?
  • Paper Toss Game Delete this if you have an
    alternative task
  • Get your students to write down one thing they
    have learnt in the lesson on scrap paper. Screw
    it up and throw it across the room. Once a piece
    of paper has made it up to their side, they
    should unravel the paper and write something
    different on it. Discuss what people have written
    down.
Write a Comment
User Comments (0)
About PowerShow.com