INTRODUCTION TO PYTHON. 1. The 5 operators in Python are: + - * / %

Slides:



Advertisements
Similar presentations
Lilian Blot CORE ELEMENTS PART I Python Language Autumn 2013 TPOP 1.
Advertisements

Objective: Students will be able to write and solve two- step equations with one variable!
Solving Multi-Step Equations with Like Terms and Parentheses.
Chapter 05 Solving for the Unknown: A How-To Approach for Solving Equations McGraw-Hill/Irwin Copyright © 2011 by the McGraw-Hill Companies, Inc. All rights.
Variables –recap-python
16-May-15 Sudden Python Drinking from the Fire Hose.
Week 6 - Programming I So far, we’ve looked at simple programming via “scripts” = programs of sequentially evaluated commands Today, extend features to:
Python November 14, Unit 7. Python Hello world, in class.
CS31: Introduction to Computer Science I Discussion 1A 4/2/2010 Sungwon Yang
Python Crash Course by Monica Sweat. Python Perspective is strongly typed, interpreted language is used to define scripts (Don't even need to define a.
Solving Equations by Adding and Subtracting: Vocabulary Solve: To solve an equation mean to find a solution to the equation. Isolate the variable: Get.
Python. What is Python? A programming language we can use to communicate with the computer and solve problems We give the computer instructions that it.
WordDefinitionExample Equation A mathematical statement that says two expressions are equal Inequality A mathematical statement that compares two expressions.
Line Continuation, Output Formatting, and Decision Structures CS303E: Elements of Computers and Programming.
Kelsey’s Unit 6 vocab By: Kelsey Mcnally.
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
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #005 (April somthin, 2015)
CS 177 Week 4 Recitation Slides Variables, Files and Functions.
_ + 7 = 11. Which number is missing? Answer = 4.
Commutative Properties The Commutative Property is when a change in the order of the numbers does not change the answer. For example, addition would be:
Equations Unit: Vocab: Equation: An equation is a statement that two numbers or expressions are equal. Equations are useful for relating variables and.
Code Grammar. Syntax A set of rules that defines the combination of symbols and expressions.
Unit 6 Math Vocab By: Marshall Lockyer. Constant Term A constant term is a term in an equation that does not change Example: a = 6 + b : In this case,
Please log on The. AN INTRODUCTION TO ‘Python is a high-level, general purpose programming language’ Python is one of the many programming languages.
ECS 15 Variables. Outline  Using IDLE  Building blocks of programs: Text Numbers Variables!  Writing a program  Running the program.
Chapter 3: Branching and Program Flow CSCI-UA 0002 – Introduction to Computer Programming Mr. Joel Kemp.
Jeopardy Solving Equations Add and Subtract Multiply and Divide Multi-Step Variables on each side Grouping Symbols $100 $200 $300 $400 $500 $100 $200.
Solve each equation in your lecture notebook. Do Now 1)x – 5 = 21 2)m – ( - 8) = -11 State the property you used in each problem.
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.
UNIT 6 VOCABULARY By: Marissa. A value of something that does not change. Example: A is always A. Constant Term.
A function is a special kind of relation. (A relation is an operation, or series of operations, that maps one number onto another.)
Welcome to AP Computer Science A We use the Java language, but this class is much more rigorous than Intro to Java More programming, but also more theory.
PROGRAMMING IN PYTHON LETS LEARN SOME CODE TOGETHER!
PYTHON VARIABLES : CHAPTER 2 FROM THINK PYTHON HOW TO THINK LIKE A COMPUTER SCIENTIST.
Thinking about programming Intro to Computer Science CS1510 Dr. Sarah Diesburg.
2.2 Solving Two- Step Equations. Solving Two Steps Equations 1. Use the Addition or Subtraction Property of Equality to get the term with a variable on.
McGraw-Hill/Irwin ©2011 The McGraw-Hill Companies, All Rights Reserved Chapter 5 Solving for the Unknown: A How-to Approach for Solving Equations.
C Building Block Chapter 2. Variables A variable is a space in the computer’s memory set aside for a certain kind of data and given a name for easy reference.
Python Arithmetic Operators OperatorOperationDescription +AdditionAdd values on either side of the operator -SubtractionSubtract right hand operand from.
Examples: = 9, so 9 – 4 = 5 3 x 4 = 12, so 12 ÷ 4 = 3
NUMBER SENTENCES 6.7.
Solving inequalities. An equation. Solve this and graph the answer on a number line: x - 2 = 5.
Introduction to Python Lesson 2a Print and Types.
Input, Output and Variables GCSE Computer Science – Python.
1.4 Solving Equations.
Numbers and arithmetic
Numbers and Arithmetic
Properties of Arithmetic
Line Continuation, Output Formatting, and Decision Structures
Formatting Output.
Lesson 4 - Challenges.
Stats Lab #1 TA: Kyle Davis
Design & Technology Grade 7 Python
IF statements.
Solving for the Unknown: A How-to Approach for Solving Equations
Variables, Expressions, and IO
Warm-up September 14, 2017 Change to a decimal: 87% 7%
Order of Operations in Math
1 Step Equation Practice + - x ÷
Solving for the Unknown: A How-to Approach for Solving Equations
Line Continuation, Output Formatting, and Decision Structures
Selection (IF Statements)
Hello World! Syntax.
Introduction to Programming Using Python PART 2
Algebra Stop Being Scared!!!.
Order of Operations PEMDAS.
Other types of variables
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.
Solving Equations.
Presentation transcript:

INTRODUCTION TO PYTHON

1. The 5 operators in Python are: + - * / %

2. Setting variables To create a variable you type the name and set it equal to an initial value Words go in quotes Example: Set name to Lia name = “Lia” Example: set score to 95 score = 95 On your own: Set hoursWorked to 40

3. Calculations Put the equation on the RIGHT side Example: To calculate cost that equals price plus 0.95 you type: cost = price On your own: calculate totalPay that equals hoursWorked times 9.75

4. The rules for naming variables are: Start with a letter (usually people use lower case letters) There can't be any blank spaces or symbols ( like & % * ) Copy the ones that are GOOD variable names for Python: sum best/cost 2Go test1 sales% firstName Last name Case matters! Sum is not the same as sum

5. Multi-step calculations In Python, if you do calculations like 3+4*2, the computer will do the multiplication and division first and then the addition and subtraction The answer to 3+4*2 is 3+(4*2) = = What is / 2 – 1?

6. Decimal points In Python you only get a decimal point in your answer if there is one in your calculation, so  7 / 2 = _____  26 / 5 = _____  10.0 / 4 = _____

7. Kinds of information For the work we are doing, there are 2 different kinds of variables: 1. words and 2. numbers

8. Changing from numbers to words When you want to “say” or “print” something in a sentence, it needs to be a string. To change a number into a string use the str function. For example x = 5 str(x)

9. Output To output in Python you print If you have 2 variables: x=6 and y=14 you can calculate their sum and print the equation with this code: The printout should show: The answer to is 22 sum=_____________________ print(_________________________________________________ ___________)

11. Equals The way to ask if 2 things are equal is ==. A = 5 sets a equal to 5 A == 5 asks if a is equal to 5

12. if To use an if/else statement you put the condition in parentheses and put a colon after the if and else lines. You must indent each statement after the if and else Example: if ( x==5): print (“x is 5”) else: print(“x is not 5”) On your own: Write the statement that says if guess equals answer print "right" otherwise print "wrong"

Make a program Calculate your age in minutes 1. age = min = age * 365 * 24 * print("you are " + str(min) + " minutes old.") 4. if(age < 20): 5. print("You are still young!") 6. else: 7. print("You are getting old!")