Programming in python Lesson 2.

Slides:



Advertisements
Similar presentations
Python Magic Select a Lesson: Why Learn to Code? Basic Python Syntax
Advertisements

Computing Theory: BBC Basic Coding Year 11. Lesson Objective You will: Be able to define what BBC basic is Be able to annotate BBC basic code Be able.
PROGRAMMING In. STARTER Using the internet…Find …  what does “case sensitive” mean  what a programming language is..  3 benefits of Python.
PROGRAMMING In Lesson 5. RECAP  Complete the starter activity.
Lecture 2 - Variables, program execution, calculations, print() COMPSCI 101 Principles of Programming.
From Scratch to Python Learn to program like the big boys / girls!
An Introduction to Textual Programming
Line Continuation, Output Formatting, and Decision Structures CS303E: Elements of Computers and Programming.
Hands on Projects Dr. Bernard Chen Ph.D. University of Central Arkansas July 9 th 2012
Introduction to Python
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: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
Input, Output, and Processing
Do it now activity Last term we learnt about how data is represented in a computer and about how to identify different volumes of data. How many bits in.
Python Programming Using Variables and input. Objectives We’re learning to build functions and to use inputs and outputs. Outcomes Build a function Use.
Type accurately challenge! This is a starter activity and should take 2 minutes [ slide 1 ] 1.Can you type out the code in Code Box 2.1 with no errors.
Lesson 6. Python 3.3 Objectives. In this lesson students will learn how to output data to the screen and request input from the user. Students will also.
Fill the screen challenge! This is a starter activity and should take 3 minutes [ slide 1 ] 1.Log in to your computer 2.Open IDLE 3.In interactive mode,
Higher Grade Computing Studies 3. High Level Language Constructs Higher Computing Software Development S. McCrossan 1 Simple Data Types Integer: An integer.
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.
Introduction to Python and programming Ruth Anderson UW CSE 140 Winter
Xin Liu Feb 4, * Use midterm questions for previous 231/217 midterms for practices * ams
Maths in Python [ slide 5 ] 1.Copy the table 2.Race a friend with a calculator to see whether Python is faster than a calculator: a) 5 * 6.5 = b)7 / 3.
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 Computer Science Lesson 4: Reviewing Loops and Arrays Reading User Input.
Advanced Work with Embedded and Summative Assessment Dr. Steve Broskoske Misericordia University EDU 533 Computer-based Education.
More about Strings. String Formatting  So far we have used comma separators to print messages  This is fine until our messages become quite complex:
C++ Basics. Compilation What does compilation do? g++ hello.cpp g++ -o hello.cpp hello.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 2A Reading, Processing and Displaying Data (Concepts)
Last Week Modules Save functions to a file, e.g., filename.py The file filename.py is a module We can use the functions in filename.py by importing it.
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.
Programming Languages Programming languages are a compromise between spoken language and formal math. They allow humans to communicate with computers at.
Starter – Its the small things in life What’s wrong with this code Height = 10 Width = 10 A = Height * Width Print A Remember to check: Spelling Spacing.
GCSE Computing: Programming GCSE Programming Remembering Python.
PROGRAMMING In Lesson 6. RECAP  Discuss with the person next to you...  what you have enjoyed about python programming  What you have found difficult.
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
Part 1 Learning Objectives To understand that variables are a temporary named location to store data and that programmers work with different data types.
Introduction to Python Lesson 2a Print and Types.
Input, Output and Variables GCSE Computer Science – Python.
Input and Output Upsorn Praphamontripong CS 1110
Learning Intention Learning Intention: To develop understanding of variables, data types, and comments in text based programming languages Context: Sequencing.
Do it now activity Last lesson we used Flowol to create a solution to a problem a computer could solve. Identify what each symbol does:
Variables, Expressions, and IO
Do it now activity Green pen activity in books.
Imperative Programming
Python I/O.
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
Programming In Lesson 3.
Hello World! Syntax.
Variables and Expressions
Starter answer these questions in your book
PYTHON: BUILDING BLOCKS Sequencing & Selection
Programming In Lesson 4.
Some Common Issues: Print, Maths, Variables
Programming In.
Introduction to Python
Introduction to Python programming for KS3
Data Types Every variable has a given data type. The most common data types are: String - Text made up of numbers, letters and characters. Integer - Whole.
Data Types and Maths Programming Guides.
Starter Which of these inventions is: Used most by people in Britain
Hardware is… Software is…
Imperative Programming
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

programming in python Lesson 2

Starter Activity Complete the starter activity

Recap Starter Recap starter What is wrong with it? print(“hello)   print(“hello) number = 17 number 17 print(“Your number is”,number) PRint(“bye”) print(“hello”) print(“bye”)

Lesson Outcomes All-Level 4- Know the key data types discussed in lesson With help be able to write a variable with help To be able to store a user inputted variable with help Understand and demonstrate the basic data types Most-Level 5- Be able to write a these with little help. Some-Level 6- independently write these and adapt them

Recap Lets recap what we learnt last lesson What is a program? A program is a sequence of instructions that specifies how to perform a computation. What is syntax? Refers to the spelling and grammar of a programming language Recap starter. Possible opportunity for grading/formative/summative assessment through the sheets.

Variables One of the most powerful features of a programming language is the ability to manipulate variables. A variable is a name that refers to a value. The assignment statement creates new variables and gives them values: >>> message = "What's up, Doc?“ >>> n = 17 Demonstrate on board

Variables >>> N = 17 >>> N >>> 17 Assignment/Input >>> N = 17 >>> N >>> 17 Variable Result/Output Demonstrate this with an example in Python

Task 1 Variables If you are stuck you can download the Help program Using variables to demonstrate basic math code. + - / * E.g. Number 1 + number 1 Variables If you are stuck you can download the Help program

Task 2 Have a look at this line of code print(“Your number is”,number) number is a variable The comma separates the text and the variable Your task is to write a code that prints a name and displays it. Have a look at the starter task to help you.

input Now we know what a variable is we can use the input statement to store things. >>> print(“what is your name”) >>>name = input() >>>print(name) Copy this on the board Adapt this code to something of your choosing e.g. a user inputs their details then you display them

Data types Integer Float String Boolean There are mean other numbers but we will stick to these main ones

Data Types Examples of strings are: 'Hello', "Goodbye". To input a string, use input() Examples of integers are: 2, 6, -89, 45421. To input an integer at the screen, use int(input()) Examples of floats are: 2.4, 6.0, -89.54, 111.111. To input a float number at the screen, use float(input()) A boolean variable always has the value True or False. Remember Python is case sensitive so the capital 'T' and 'F' really matters!

Data types What is a string? Examples of strings are: 'Hello', "Goodbye". How do you enter it? Input() What is a integer are: 2, 6, -89, 45421. int(input()) What is a float number float(input()) What is a boolean? has the value True or False. Variableboolean = True

Task 4 Have a go at entering these values and displaying them strings are: 'Hello', "Goodbye". To input a string, use input() integers are: 2, 6, -89, 45421. To input an integer at the screen, use int(input()) 2.4, 6.0, -89.54, 111.111. To input a float number at the screen, use float(input()) A boolean variable always has the value True or False. Remember Python is case sensitive so the capital 'T' and 'F' really matters!

Task 3 Your code should look something like this

Self Evaluation Task Open the Self Evaluation Task. Have a look at the outcomes of the lesson. Write down the level you think you got this lesson Self evaluate your progress this lesson and write your Level and your Student Next Step.

Plenary Now we know what a variable is we can use the input statement to store things. >>> print(“what is your name”) >>>name = _________ >>>print(name) input()

Plenary Integer _______ String There are mean other numbers but we will stick to these main ones Float Boolean

Plenary 'Hello', "Goodbye". 2, 6, -89, 45421. float(input()) What is a string? Examples of strings are: How do you enter it? Input() What is a integer are: int(input()) What is a float number What is a boolean? has the value True or False. Variableboolean = True 'Hello', "Goodbye". 2, 6, -89, 45421. float(input())

Acknowledgments Some resources and lessons were taken from http://www.pythonsummerschool.net/