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.

Slides:



Advertisements
Similar presentations
Chapter 3. Expressions and Interactivity CSC125 Introduction to C++
Advertisements

Programming in python Lesson 2.
CS 1400 Chapter 2 sections 1, 2, 4 – 6, 8,
CIS 234: Using Data in Java Thanks to Dr. Ralph D. Westfall.
Differences between Java and C CS-2303, C-Term Differences between Java and C CS-2303, System Programming Concepts (Slides include materials from.
Python November 14, Unit 7. Python Hello world, in class.
Introduction to Python
Python Programming Fundamentals
C Programming Lecture 3. The Three Stages of Compiling a Program b The preprocessor is invoked The source code is modified b The compiler itself is invoked.
Introduction to Python
Python Programming Introduction to programming using python.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Pascal Programming Strings, Arithmetic operators and output formatting National Certificate – Unit 4 Carl Smith.
Python Types Python values are of various “types” Ints, Floats, Strings, Characters, and more Two representations of numbers 1 vs 1.0.
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
Computer Science 101 Introduction to Programming.
Operators in Python. Arithmetic operators Some operators in Python will look familiar (+, -, *, /) Others are new to you (%, //, **) All of these do work.
Variables and Expressions CMSC 201 Chang (rev )
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.
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,
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.
1 Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Chapter 2 Variables.
Data,information Data and Information 4 Data –Raw, unorganised facts –Ideas or concepts 4 Information –When data is manipulated into a meaningful form.
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.
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.
Introduction to Programming Lecture 4. Key Words of C main main if if else else while while do do for for.
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:
Values, Types, and Variables. Values Data Information Numbers Text Pretty much anything.
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.
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
PYTHON VARIABLES : CHAPTER 2 FROM THINK PYTHON HOW TO THINK LIKE A COMPUTER SCIENTIST.
GCSE Computing: Programming GCSE Programming Remembering Python.
CS0007: Introduction to Computer Programming Primitive Data Types and Arithmetic Operations.
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.
What will each of the following lines print? System.out.println("number" ); number645 System.out.println("number" + (6 + 4)+ 5); number105 System.out.println(6.
Input, Output and Variables GCSE Computer Science – Python.
Data Types and Conversions, Input from the Keyboard
Variables, Expressions, and IO
Python Lesson 6 Mr. Kalmes.
G7 programing language Teacher / Shamsa Hassan Alhassouni.
Python Lessons 9 & 10 Mr. Kalmes.
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:
Dividing Decimals.
“If you can’t write it down in English, you can’t code it.”
Divisibility and Mental Math
G7 programing language Teacher / Shamsa Hassan Alhassouni.
Python Lessons 9 & 10 Mr. Husch.
Dividing a whole number to get decimal
Dividing a decimal by a whole number
Beginning Python Programming
Understanding Code Workshop 2.
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.
Class code for pythonroom.com cchsp2cs
More Basics of Python Common types of data we will work with
Programming Fundamental-1
Python Creating a calculator.
Presentation transcript:

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 = c) = d)How many times does 120 divide by 7? e)What is the remainder of 120 / 7?

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