Python Programming Using Variables and input. Objectives We’re learning to build functions and to use inputs and outputs. Outcomes Build a function Use.

Slides:



Advertisements
Similar presentations
EasyGUI “Probably the Easiest GUI in the world”. Assumptions (Teachers’ Notes) This resources sets out an introduction to using easyGUI and Python
Advertisements

What have you learnt this lesson that can be linked to a previous lesson.
Programming in python Lesson 2.
Sequencing Miss Regan. Blood Hound  Does anyone know what the Bloodhound project is?  Video 1 Video 1  Video 2 Video 2  Link to website Link to website.
The Scratch Calculator You are all going to be real computer programmers!!!
An Introduction to Textual Programming
Python Programming Using Variables and input. Objectives We’re learning to make use of if statements to enable code to ask questions. Outcomes Build an.
Python Programming Introduction to programming using python.
Python File Handling. In all the programs you have made so far when program is closed all the data is lost, but what if you want to keep the data to use.
Make a blank window This is a starter activity and should take 5 minutes [ slide 1 ] 1.Log in to your computer 2.Open IDLE 3.In script mode create a file.
Lesson 4 Using Variables in Python – Creating a Simple ChatBot Program.
PROGRAMMING In Lesson 2. STARTER ACTIVITY Complete the starter activity in your python folder – lesson 2 Now we will see how you got on and update your.
Python Programming Using Variables and input. Objectives We’re learning to use basic knowledge of variables combined with user input. Outcomes Continue.
Variables. Todays Lesson  In todays lesson you are going to:  Learn to use variables  Learn to ask for user input  Learn to save the users response.
PROGRAMMING In. Objectives  We’re learning to develop basic code with the use of the correct syntax and variables. Outcomes  Explain what syntax is.
Advanced Work with Embedded and Summative Assessment Dr. Steve Broskoske Misericordia University EDU 533 Computer-based Education.
End of unit assessment Challenge 1 & 2. Course summary So far in this course you have learnt about and used: Syntax Output to screen (PRINT) Variables.
My Python Programmes NAME:.
Introduction to Python Lesson 1 First Program. Learning Outcomes In this lesson the student will: 1.Learn some important facts about PC’s 2.Learn how.
Lesson 3 - The Entry Box.. Last week We produced a Tkinter window with a label and a button Now we are going to create a new program that creates a Button.
Sequencing The most simple type of program uses sequencing, a set of instructions carried out one after another. Start End Display “Computer” Display “Science”
Trinity College Dublin, The University of Dublin GE3M25: Computer Programming for Biologists Python Karsten Hokamp, PhD Genetics TCD, 03/11/2015.
Simulation and Modeling: Predator-Prey Processing Lab IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 23, 2014 Carolyn Seaman Susan.
PROGRAMMING IN PYTHON LETS LEARN SOME CODE TOGETHER!
Python Lesson 1 1. Starter Create the following Excel spreadsheet and complete the calculations using formulae: 2 Add A1 and B1 A2 minus B2 A3 times B3.
GCSE Computing: Programming GCSE Programming Remembering Python.
 Write the Learning objective onto your Self Assessment Sheet LO: Learn how to add different types of paths to a world and control an enemy within a.
Programming In Python. Starter Using the internet… Find what a programming language is.
COMPUTER PROGRAMMING Year 9 – lesson 1. Objective and Outcome Teaching Objective We are going to look at how to construct a computer program. We will.
Getting Started With Python Brendan Routledge
Introducing Python 3 Introduction to Python. Introduction to Python L1 Introducing Python 3 Learning Objectives Know what Python is and some of the applications.
Part 1 Learning Objectives To understand that variables are a temporary named location to store data and that programmers work with different data types.
Learning to use a ‘For Loop’ and a ‘Variable’. Learning Objective To use a ‘For’ loop to build shapes within your program Use a variable to detect input.
Introducing Python Introduction to Python.
Create Your Own Quiz using_Python KS3 COMPUTING KS3 Computing
Whatcha doin'? Aims: To start using Python. To understand loops.
Lesson 1 - Sequencing.
Introduction to Python
Learning Intention Learning Intention: To develop understanding of variables, data types, and comments in text based programming languages Context: Sequencing.
Lesson 1 An Introduction
Functions CIS 40 – Introduction to Programming in Python
To write a Python program, you first need to open Pyscripter
Explain what touch develop is to your students:
Learning to Program in Python
Teaching London Computing
Python I/O.
Fill the screen challenge!
Explain what touch develop is to your students:
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
Programming In Lesson 3.
Python Lessons 13 & 14 Mr. Kalmes.
Introduction to TouchDevelop
Python 21 Mr. Husch.
Functions Christopher Harrison | Content Developer
LMC Little Man Computer What do you know about LMC?
PYTHON: BUILDING BLOCKS Inputs & Outputs
PYTHON: BUILDING BLOCKS Sequencing & Selection
Explain what touch develop is to your students:
Programming In Lesson 4.
Programming In.
Input and Output Python3 Beginner #3.
Introduction to Python
Introduction to Python programming for KS3
Python 3 Mr. Husch.
Python Lessons 13 & 14 Mr. Husch.
Explain what touch develop is to your students:
Starter Which of these inventions is: Used most by people in Britain
What you need to do… Drag the pieces of code into the correct order like you can see in the EXAMPLE below. print ( “ int input ) = + Hello world chr ord.
Programming Techniques
Presentation transcript:

Python Programming Using Variables and input

Objectives We’re learning to build functions and to use inputs and outputs. Outcomes Build a function Use inputs and outputs Introduce a parameter

Isn’t there another way? - Starter Discuss alternative ways of doing this. This is a program which asks for a name input 5 times. print (“what is your name”) name = input() Print(name) print (“what is your name”) name = input() Print(name) print (“what is your name”) name = input() Print(name) print (“what is your name”) name = input() Print(name) print (“what is your name”) name = input() Print(name)

Isn’t their another way? – Starter / Answers FUNCTIONS!! def main(): print (“what is your name”) name = input() Print(name) In terms of programming, the function is something which carries a sequence of instructions. It saves us from repeating instructions over and over.

Don’t forget your input? In your previous lesson, you learnt how to store variables. We completed this program which asks for our name and age. If we want to re-use this we can put it in a function. Lets break this down….

What is a function? In your previous lesson, you learnt how to store variables. The first thing you must do is define the function. This lets the program know that the function is available to use. This function creates the text hello. You should open up a new program in python and set up your code so that it uses a function. Try running it by saving it as a.py file and then press F5 on your keyboard. When in the shell, type main() to see it work.

Tasks ? Write the following functions: 1.A function to save your name and print it to the screen. 2.A function to ask the user for 2 numbers and add them together 3.A function to ask the user for their name, age and place of birth and build a sentence with the use of the input variables.

Extension – Introduction of parameters? When creating a function within your game, you can include parameters. They are used to customise the program. You don’t always need the program to ask for input. You can use parameters to pass in filenames, text and other variables.

Parameter – Spot the difference

Tasks ? Modify your functions to include parameters: 1.Include your name in a parameter of your first function. 2.Use two parameters to calculate numbers. 3.Use the previous example to create your own function which uses parameters for age, name and place of birth.

Plenary Self Assessment: Your teacher has issued you with a self assessment sheet. You will have today’s 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? Include the parameters in the correct place Your teacher has given you a piece of code. You must include the correct parameters in the correct place.