Python Lessons 9 & 10 Mr. Husch.

Slides:



Advertisements
Similar presentations
Python November 14, Unit 7. Python Hello world, in class.
Advertisements

Python November 18, Unit 7. So Far We can get user input We can create variables We can convert values from one type to another using functions We can.
 2002 Prentice Hall. All rights reserved. 1 Intro: Java/Python Differences JavaPython Compiled: javac MyClass.java java MyClass Interpreted: python MyProgram.py.
Rational numbers. Whole numbers Whole numbers Rational numbers Whole numbers Natural numbers Integers / ¾ 18% A rational number.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #005 (April somthin, 2015)
16. Binary Numbers Programming in C++ Computer Science Dept Va Tech August, 1999 © Barnette ND, McQuain WD, Keenan MA 1 Binary Number System Base.
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.
COMP 171: Data Types John Barr. Review - What is Computer Science? Problem Solving  Recognizing Patterns  If you can find a pattern in the way you solve.
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.
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.
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,
Rational Numbers SWBAT identify rational numbers; identify rational numbers as termination or nonterminating repeating decimal; locate rational numbers.
For Loop GCSE Computer Science – Python. For Loop The for loop iterates over the items in a sequence, which can be a string or a list (we will discuss.
Input, Output and Variables GCSE Computer Science – Python.
Nat 4/5 Computing Science Lesson 1: Binary
JUST BASIC Lessons 6 – 9 Mr. Kalmes.
IGCSE 4 Cambridge Data types and arrays Computer Science Section 2
Variables and Expressions
Chapter 3: I/O Management
Python 6 Mr. Husch.
Rational Numbers SWBAT define the set of rational numbers; identify subsets of rational numbers; write rational numbers in equivalent forms.
MONEY CONVERSION.
Python 18 Mr. Husch.
Python Lesson 6 Mr. Kalmes.
Unit 3: Rational Number Conversions
Python Lessons 9 & 10 Mr. Kalmes.
Fractions and Decimals
Learning Outcomes –Lesson 4
Python Lessons 13 & 14 Mr. Kalmes.
Lesson Aims Vocabulary In this lesson you are going to:
Java Lesson 36 Mr. Kalmes.
Python Lesson 21 Mr. Kalmes.
Objective: Students will convert fractions to decimal equivalents.
Variables and Expressions
Python 9 Mr. Husch.
Ratios, Rates and Percents
Python 21 Mr. Husch.
Java Lessons 5 – 8 Mr. Kalmes.
More elements of Python programs
Python 19 Mr. Husch.
Unit 2. Day 14..
Rational Numbers: terminate or repeat a ratio of two integers,
Python Lesson’S 1 & 2 Mr. Kalmes.
Just Basic Lessons 7&8 Mr. Kalmes.
Python 16 Mr. Husch.
Basic Lessons 5 & 6 Mr. Kalmes.
Conversions Decimals to Fractions and Fractions to Decimals.
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.
Data Types and Maths Programming Guides.
Python Inputs Mr. Husch.
Python Lessons 13 & 14 Mr. Husch.
Basic Mr. Husch.
Python 16 Mr. Husch.
Conversions Decimals to Fractions and Fractions to Decimals.
Unit 2 Chapter 3 Real Numbers
Python 19 Mr. Husch.
Python Lessons 7 & 8 Mr. Husch.
Python 10 Mr. Husch.
Python 18 Mr. Husch.
Python 4 and 5 Mr. Husch.
Python 8 Mr. Husch.
Conversions Decimals to Fractions and Fractions to Decimals.
Basic 9 Mr. Husch.
Express the fraction to decimal.
Python Creating a calculator.
Getting Started in Python
Section 6 Primitive Data Types
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

Python Lessons 9 & 10 Mr. Husch

Aims Recreate a program using raw input Understand functions in Python Create a program that combines python functions

Python Lesson 9

Changing to integer: YOU DO NOT NEED TO BUILD, IT IS JUST AN EXAMPLE! If you don’t change the strings to an integer it will keep the quotes around the string not allowing you to combine them.

Lesson 9 Activity You must recreate lesson 4 activity 1 using nothing but raw inputs. You should have 7 raw inputs asking for John Doe information. After your inputs you need to print out the seven variables in a single line of code using %r instead of %s or %d.

Python Lesson 10

What’s new—Hint this is the long way, see if you can figure out the simple way.

New Stuff Function: a block of organized, reusable code that is used to perform a single, related action Float(): Also called floats, they represent real numbers and are written with a decimal point dividing the integer and fractional parts.  Round(x,n): Rounds the number x, to the n digits from the decimal

Lesson 10 Activity You are to recreate slide 7 but add 4 more conversions. You should have all your inputs first , conversions second, and print out each conversion in a single print line using your escape sequences

Exit Slip Questions What is a function? Write a line of code that converts Dollars to Cents.