NAME Python Programming Workbook Select a Lesson:

Slides:



Advertisements
Similar presentations
Computing Science Software Design and Development SOFTWARE DESIGN AND DEVELOPMENT USING PYTHON.
Advertisements

Python Magic Select a Lesson: Why Learn to Code? Basic Python Syntax
Variables and I/O. Types Strings –Enclosed in quotation marks –“Hello, World!” Integers –4, 3, 5, 65 Floats –4.5, 0.7 What about “56”?
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.
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.
INTRODUCTION TO ALGORITHMS PROGRAMMING. Objectives Give a definition of the term algorithm Describe the various parts of the pseudocode algorithm or algorithm.
PYTHON. Python is a high-level, interpreted, interactive and object- oriented scripting language. Python was designed to be highly readable which uses.
Review for Mid-term! October 26, Review Homework Worksheet True or False Operators are symbols that perform specific operations in Visual Basic.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 2 Input,
Bug Session Four. Session description Objectives Session activities summary Resources Prior knowledge of sequencing instructions using Bug Bug website.
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 – Part 1 Python Programming Language 1. What is Python? High-level language Interpreted – easy to test and use interactively Object-oriented Open-source.
Conditions. Objectives  Understanding what altering the flow of control does on programs and being able to apply thee to design code  Look at why indentation.
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.
1 Boolean Expressions to Make Comparisons Boolean expression –Represents only one of two states –Expression evaluates to either true or false Expressions.
Introduction to Programming with RAPTOR
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Algorithms  Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Python Programming Using Variables and input. Objectives We’re learning to use basic knowledge of variables combined with user input. Outcomes Continue.
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.
Variables, Expressions and Statements
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.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
Trinity College Dublin, The University of Dublin GE3M25: Computer Programming for Biologists Python Karsten Hokamp, PhD Genetics TCD, 03/11/2015.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 2 Input,
The Hashemite University Computer Engineering Department
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.
NAME Python Programming Workbook Select a Lesson:
GCSE Computing: Programming GCSE Programming Remembering Python.
Introduction to Programming Python Lab 7: if Statement 19 February PythonLab7 lecture slides.ppt Ping Brennan
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
Linux Administration Working with the BASH Shell.
Part 1 Learning Objectives To understand that variables are a temporary named location to store data and that programmers work with different data types.
Algorithms and Flowcharts
Select a Lesson: »Lesson 1 Basic syntaxLesson 1 Basic syntax »Lesson 2 Escape sequencesLesson 2 Escape sequences »Lesson 3 Mathematical functionsLesson.
PROBLEM SOLVING WARM-UP Fill in the spaces using any operation to solve the following (!, (), -/+,÷,×): = 6.
Starter What does the following code do?
Fundamentals of Programming I Overview of Programming
Topics Designing a Program Input, Processing, and Output
GCSE COMPUTER SCIENCE Practical Programming using Python
Input and Output Upsorn Praphamontripong CS 1110
GCSE COMPUTER SCIENCE Practical Programming using Python
Introduction to Programming
Variables, Expressions, and IO
Design and Technology Academic Year 2017/2018 Grade 7 First Semester.
Learning to Program in Python
Lesson 1 Learning Objectives
Fill the screen challenge!
Learning Outcomes –Lesson 4
Escape sequences: Practice using the escape sequences on the code below to see what happens. Try this next code to help you understand the last two sequences.
Teaching London Computing
Lesson Aims Vocabulary In this lesson you are going to:
Chapter 5: Control Structure
Topics Designing a Program Input, Processing, and Output
Boolean Expressions to Make Comparisons
Topics Designing a Program Input, Processing, and Output
Topics Designing a Program Input, Processing, and Output
Programming In Lesson 4.
Beginning Python Programming
Chapter 1: Programming Basics, Python History and Program Components
Introduction to Python
Python 4 and 5 Mr. Husch.
Starter Activities GCSE Python.
Hardware is… Software is…
Presentation transcript:

NAME Python Programming Workbook Select a Lesson: Lesson 1 Basic syntax Lesson 2 Escape sequences Lesson 3 Mathematical functions

Lesson 1 Basic Syntax

Activity 1.1- Write a program to print out “Hello World” Programming screen Python Shell Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments: Did you have to correct any errors? If so, what were they?

Activity 1.2- Write a program that writes your name on the screen Programming screen Python Shell Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments: Did you have to correct any errors? If so, what were they?

Activity 1.3 practice- Copy the following code into python Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments:

Activity 1.3- Write a program that prints your name six times Programming screen Python Shell Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments: Did you have to correct any errors? If so, what were they?

Lesson 2 Escape sequenses

Activity 2.1- True or false Are the below statement True or False? Highlight the correct answers! Python was released in 2010 True or false? Python was named after the TV series “Monty Python’s Flying Circus” Python is proprietary software which is expensive to buy Python was written by Bill Gates YouTube is written in Python Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments:

What does the keyboard shortcut do? Activity 2.2- Keyboard shortcuts Make a note of what these useful keyboard shortcuts do! Keyboard shortcut What does the keyboard shortcut do? Control c   Control v Control a Control x Control f Control n Control p Control s Control z Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments:

Activity 2.3 practice- Copy the following code into python Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments:

Did you have to correct any errors? If so, what were they? Activity 2.3- Write a program that writes four lines of the lyrics of your favourite song on the screen Programming screen Python Shell Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments: Did you have to correct any errors? If so, what were they?

Activity 2.4 – Copy and run this program   What happens? 2.What effect does the ”,“ have? Python Shell Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments:

Activity 2.5 – Escape sequences Escape sequences can be used to alter how the information is displayed on the screen. An escape sequence is a back slash “\”. Experiment with these escape sequences and complete the table. Hint: Use alt p to display the last command entered in the IDLE shell Escape sequence Effect \t   \n \\ \’ \” Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments:

Activity 2.6- Print this text using one line of code Programming screen Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments: Did you have to correct any errors? If so, what were they?

Activity 2.7- Write a program using print commands to display your initials five characters high on the screen. For example: Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments:

Did you have to correct any errors? If so, what were they? Activity 2.7- Write a program using print commands to display your initials five characters high on the screen. Programming screen Python Shell Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments: Did you have to correct any errors? If so, what were they?

Activity 2.8- An algorithm is a sequence of steps needed to perform a particular task. Algorithms can be represented in different ways. Match the words to the representations on the next three slides. Flowchart Program code Pseudocode Written description Structured English A Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments:

Match the words to the representations. Flowchart Program code Pseudocode Written description Structured English B RECEIVE myName FROM (STRING) KEYBOARD RECEIVE myAge FROM (INTEGER) KEYBOARD SET AgeInTen TOmyAge + 10 SEND myName “will be” AgeInTen “in 10 years time” TO DISPLAY C Write a program that prompts the user to enter their name and age. The program then adds 10 onto the age and displays the text “<name entered> will be <age + 10> in ten years time.”

D E Match the words to the representations. Flowchart Program code Pseudocode Written description Structured English D E If animal has 4 legs then If animal has a tail then If animal answers to “puss” then animal = cat endif

Activity 2.9- Explore ASCII art (Wikipedia) and write a Python program to display your ASCII art creation. For example: Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments:

Did you have to correct any errors? If so, what were they? Activity 2.9- Explore ASCII art (Wikipedia) and write a Python program to display your ASCII art creation. Programming screen Python Shell Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments: Did you have to correct any errors? If so, what were they?

Mathematical functions Lesson 3 Mathematical functions

Activity 3.1- Copy and run these lines of code. Complete the table to explain what the mathematical operators do. >>> 60/5 >>> 987+34 >>> 564*89 >>> 2**5 >>> 43-5 >>> 11//2 >>> 11%2 Mathematical operator symbol Operation / + * ** - // % Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments:

Activity 3.2- Make up some mathematical calculations of your own and add an example to the table for each mathematical operator. Mathematical operator symbol Example Answer / + * ** - // % Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments:

The cats have ___ legs in total Activity 3.3.1- Write a program to display this text on the screen and fill in the missing number. 8 cats have 4 legs each The cats have ___ legs in total Programming screen Python Shell Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments:

A farmer with 1089 sheep sells 56 of them Activity 3.3.2- Write a program to display this text on the screen and fill in the missing number. A farmer with 1089 sheep sells 56 of them The farmer has _____ sheep left Programming screen Python Shell Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments:

4 children pick 56 flowers each The children each have ____ flowers Activity 3.3.3- Write a program to display this text on the screen and fill in the missing number. 4 children pick 56 flowers each The children each have ____ flowers Programming screen Python Shell Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments:

Activity 3.4- Copy and run these lines of code. Programming screen Python Shell Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments: What effect do the parentheses () have?

Activity 3.5- Predict what you think will be displayed on the screen when this line of code is executed. Prediction Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments: Now copy and run the code. Explain the answer you get. Is it what you predicted?

Activity 3.6- Make up some multiple-choice questions on precedence. Each question must have four possible answers, one of which is correct. Check your answers are correct by using the interactive Python shell. Try your questions out on other people and document this using the template on the next slide. Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments: You must be able to explain to them why the answers are correct.

Activity 3.6- Make up some multiple-choice questions on precedence. Outcome Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments: Can you explain how you got the outcome you did?

Activity 3.7- Devise your own mnemonic for remembering the order of precedence. Python order of precedence Mnemonic Parenthesis (brackets) Exponential Division and multiplication Addition and subtraction Assessment: TA/PA/SA Date ??/??/?? Teacher Comments: Students Comments: