Download presentation
Presentation is loading. Please wait.
1
Lesson 1 - Sequencing
2
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’.
3
What is a Program? 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
4
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.
5
“What’s your name?” Strings
In programming we usually call normal text a string. “What’s your name?” 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.
6
Here is another example of a program using sequencing.
Start It is important to know there is usually more than one correct solution to a program. Boil kettle Add tea bag Add hot water Add milk End
7
Sequencing print (“World”) print (“Hello”)
Below is the python code to the program shown in the flowchart. Start print (“World”) Display “Hello” print (“Hello”) Display “World” End Spot the error The code is in the wrong order.
8
Match the Python code to the correct part of the flowchart.
Sequencing Match the Python code to the correct part of the flowchart. Start Display “Computer” print(“Computer) Display “Science” prit(“Science”) Display “Rocks” print“Rocks”) Spot the 3 errors End The code must be exact.
9
Demonstration – First Python Program
Your teacher will now walk you through your first Python program Start Display “Hello” print (“Hello”) End Create a folder on your personal drive (H:) called Python. Press F5 and save your program as hello in your Python folder.
10
Second Python Program Start / Computer / ICT (I:) / Python / IDLE Open the Python IDLE. Start a new program by clicking on File > New File. REMEMBER: To start a new program click on File > New File. Enter the code. print(“Computer) Correct the mistakes. prit(“Science”) print“Rocks”) Press F5 and save your program as computer in your Python folder.
11
Third Python Program Now write a program to print out your full name. REMEMBER: To start a new program click on File > New File. Use your previous programs to help you, Save your program as name and press F5 to run it.
12
Video Watch this short clip about coding:
Link:
13
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. Name
14
Type the Python code below and press F5 to run.
Variables Example 1 Type the Python code below and press F5 to run. Start Input Name Display “Hello “ + name End Create a Python program based on the code above and save it as variables1. Press F5 to run it.
15
Variables Example 2 Type the Python code below and press F5 to run. We use int to tell Python we are going to enter an integer (whole number). We use float when working with decimal places. Start Input Age age = int(input(“How old are you? ”)) print (“You are ” + str(age) + “ years old.”) Display “You are “ + age We use str to convert a number into a string. End Create a Python program based on the code above and save it as variables2. Press F5 to run it.
16
Variables Challenge Use the previous examples to help you. Create a program that outputs the following, making use of three variables: My name is name, I am age years old and I go to school. name = input(“Wh… age = int(input(“How… school = input(“Wh… print(“My name is ” + name + “and my age is” + str(age)… HELP Save it as variables3. Press F5 to run it.
17
Variables Challenge Solution
name = input(“What is your name? ”) age = int(input(“How old are you?”)) school = input(“What school do you go to?”) print(“My name is ” + name + “ , my age is” + str(age) + “ and I go to ” + school + “ school.”)
18
Variables Extension Add a question about your favourite subject
Add extra information to your program, for example: Add a question about your favourite subject Add a question about extra curricular clubs Add more school related questions!
19
Python Where do you find Python? How do you start a new program?
Start / Computer / ICT (I:) / Python / IDLE In Python go to: File / New File How do you run a program? Where do you save your programs? Press the F5 key (on the top row) In the Python folder you have created in you personal area (H:)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.