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.

Slides:



Advertisements
Similar presentations
Programming in python Lesson 2.
Advertisements

 2002 Prentice Hall. All rights reserved. 1 Intro: Java/Python Differences JavaPython Compiled: javac MyClass.java java MyClass Interpreted: python MyProgram.py.
Basic Input/Output and Variables Ethan Cerami New York
CHAPTER 3: CORE PROGRAMMING ELEMENTS Introduction to Computer Science Using Ruby (c) 2012 Ophir Frieder et al.
Computing with Numbers CSC 161: The Art of Programming Prof. Henry Kautz 9/14/2009.
Introduction to Python
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #001 (January 9, 2015)
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #002 (January 17, 2015)
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Programs, programs, everywhere! This is a starter activity and should take 5 minutes 1.Open up a text editor such as Notepad. 2.Write a list of all the.
Agenda  Commenting  Inputting Data from Keyboard (scanf)  Arithmetic Operators  ( ) * / + - %  Order of Operations  Mixing Different Numeric Data.
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
Java Data Types. Primitive Data Types Java has 8 primitive data types: – char: used to store a single character eg. G – boolean: used to store true or.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 2 Input,
Input, Output, and Processing
Copy, paste, amend This is a starter activity and should take 5 minutes [ slide 1 ] 1.Log in to your computer 2.Open myEtchASketch.py in IDLE 3.Check you.
Fundamentals of Python: First Programs
Python Programming Using Variables and input. Objectives We’re learning to build functions and to use inputs and outputs. Outcomes Build a function 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.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
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,
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.
1 Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #001 (January 17, 2015)
Graphical User Interface You will be used to using programs that have a graphical user interface (GUI). So far you have been writing programs that have.
Make a dice challenge! This is a starter activity and should take 5 minutes [ slide 1 ] 1.Log in to your computer 2.Open IDLE 3.Copy the code below in.
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.
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.
Debugging, Escape Command, More Math. It’s your birthday!  Write a program that asks the user for their name and their age.  Figure out what their birth.
Python Let’s get started!.
Data Types and Conversions, Input from the Keyboard CS303E: Elements of Computers and Programming.
Coding Time This is a starter activity and should take about 10 minutes [ slide 1 ] 1.Log in to your computer 2.Open IDLE 3.Start a script session (Select.
NAME Python Programming Workbook Select a Lesson:
Data Types and Conversions, Input from the Keyboard If you can't write it down in English, you can't code it. -- Peter Halpern If you lie to the computer,
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.
Part 1 Learning Objectives To understand that variables are a temporary named location to store data and that programmers work with different data types.
Make a function This is a starter activity and should take 5 minutes [ slide 1 ] >>> def count(number): n=1 while n
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.
Input, Output and Variables GCSE Computer Science – Python.
Whatcha doin'? Aims: To start using Python. To understand loops.
Topics Designing a Program Input, Processing, and Output
Lesson 1 - Sequencing.
Data Types and Conversions, Input from the Keyboard
Lesson 4 - Challenges.
Variables, Expressions, and IO
Computational Thinking
Computational Thinking
Python I/O.
Today’s lesson – Python next steps
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
Learning Outcomes –Lesson 4
The backslash is used to escape characters that are used in Python
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.
Lesson Aims Vocabulary In this lesson you are going to:
Python Lessons 9 & 10 Mr. Husch.
Topics Designing a Program Input, Processing, and Output
Topics Designing a Program Input, Processing, and Output
Beginning Python Programming
Introduction to Python programming for KS3
Python Lessons 7 & 8 Mr. Kalmes.
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.
Python 8 Mr. Husch.
Class code for pythonroom.com cchsp2cs
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

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 – first time? 2. Can you work out what \n does?

Lesson Aims 1.Learn how to do more with text 2.Get Python to do some maths for you 3.Learn how to combine maths and text [ slide 2 ] Vocabulary escape sequence string integer float function mathematical operator modulus interactive mode In this lesson you are going to:

Programming Session Rules 1.Try to complete the task set on your own computer 2.If you have finished and are waiting, you may: try out your own code help other students who are stuck. 3.When asked to stop: go back to your seat stop coding listen carefully. [ slide 3 ]

Escape sequences: [ slide 4 ] You have been using IDLE in interactive mode. This is when we write a command and it is run as soon as we press ENTER on the keyboard. Interactive mode is great for experimenting. 1.Read page 17 and 18 in the textbook. 2.Using a copy your code from Code Box 2.1, change the escape sequence to some of those below to see what they do. 3.Try running the code from Code Box 2.2 and 2.3 (on page 18)

Maths in Python [ slide 5 ] 1.Read the Maths section on page 19 and 20 2.Race a friend with a calculator to see whether Python is faster than a calculator: a) 5 * 6.5 = b)7 / 3 = c) = d)How many times does 120 divide by 7? e)What is the remainder of 120 / 7?

Functions (more in chapter 4) [ slide 6 ] print() is a function. We can put a variety of things inside the brackets to be printed to the screen. So far we have supplied bits of text but it can do much more... Coders call text, strings. Output from the print function appears in blue text.

Combining Maths and Text [ slide 7 ] The print() function will print to screen: strings, numbers or calculations separated by commas: Interactive session: >>> print("111 divided by 4 = ", 111/4) 111 divided by 4 = >>> print("11 divided by 4 = ", 11/4) 11 divided by 4 = 2.75 What will the output from this code produce? >>> print("11 divided by 4 = ", 11//4, "remainder ", 11%4) 11 divided by 4 = 2 remainder 3 >>> print("I will not write code in history lessons.\n" *50) See what else you can produce. Can you fill the screen with your name? Now try entering this code:

Lesson Summary In coding, snippets of text are called... [ slide 8 ] In this lesson you have: strings Whole numbers are called... integers Numbers with a decimal point are called... floating point numbers (or floats) To use special Python characters we need...escape sequences In Python, the remainder of a division is called... modulus 1.Learnt how to do more with text 2.Got Python to do some maths for you 3.Learnt how to combine maths and text