Getting Started 27 June 2016 Week 1, Day 1. Who am I? Name: Christopher Little Town: Cambridge Eats: Chips.

Slides:



Advertisements
Similar presentations
Types and Arithmetic Operators
Advertisements

1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
Hand Crafting your own program By Eric Davis for CS103.
Introduction to Python
1 The First Step Learning objectives write Java programs that display text on the screen. distinguish between the eight built-in scalar types of Java;
Introduction to Python and programming Michael Ernst UW CSE 190p Summer 2012.
Lecture 2 - Variables, program execution, calculations, print() COMPSCI 101 Principles of Programming.
Introduction to Python
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
Munster Programming Training
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Introduction to Computational Linguistics Programming I.
1 CSC 221: Introduction to Programming Fall 2012 Functions & Modules  standard modules: math, random  Python documentation, help  user-defined functions,
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
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
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #005 (April somthin, 2015)
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Introduction to Python and programming Ruth Anderson UW CSE 140 Winter
CS Class 03 Topics  Sequence statements Input Output Assignment  Expressions Read pages Read pages 40 – 49 for next time.
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.
JavaScript 1 COE 201- Computer Proficiency. Introduction JavaScript scripting language ▫Originally created by Netscape ▫Facilitates disciplined approach.
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.
Literals A literal (sometimes called a constant) is a symbol which evaluates to itself, i.e., it is what it appears to be. Examples: 5 int literal
Course A201: Introduction to Programming 09/09/2010.
Part 1 Learning Objectives To understand that variables are a temporary named location to store data and that programmers work with different data types.
CSC Programming for Science Lecture 5: Actual Programming.
Input, Output and Variables GCSE Computer Science – Python.
CSC 108H: Introduction to Computer Programming Summer 2011 Marek Janicki.
GCSE COMPUTER SCIENCE Practical Programming using Python Lesson 4 - Selection.
Foundations of Programming: Java
Math operations 9/19/16.
Numbers and arithmetic
Lesson 03: Variables and Types
GCSE COMPUTER SCIENCE Practical Programming using Python
Numbers and Arithmetic
Topics Designing a Program Input, Processing, and Output
IGCSE 1 Cambridge Algorithms and flowcharts Unit 7 Computer Science
Lesson 1 - Sequencing.
Week of 12/12/16 Test Review.
Lecture 4: Expressions and Variables
Data Types and Conversions, Input from the Keyboard
Design & Technology Grade 7 Python
CS 1428 Exam I Review.
Introduction to Programming
Variables, Expressions, and IO
CMSC201 Computer Science I for Majors Lecture 03 – Operators
Computational Thinking
Computational Thinking
Learning to Program in Python
Lecture 3: Expressions and Variables
CS 1428 Final Exam Review.
Intro to Programming Week # 2 Variables/Data type Lecture # 4 & 5
Lesson 03: Variables and Types
Topics Designing a Program Input, Processing, and Output
Topics Designing a Program Input, Processing, and Output
Lecture 2 Python Programming & Data Types
CS 1428 Final Exam Review.
Introduction to Programming with Python
Topics Designing a Program Input, Processing, and Output
Lecture 4: Expressions and Variables
Topics Designing a Program Input, Processing, and Output
Winter 2019 CISC101 4/28/2019 CISC101 Reminders
Unit 3: Variables in Java
General Computer Science for Engineers CISC 106 Lecture 03
Text Copyright (c) 2017 by Dr. E. Horvath
Hardware is… Software is…
Data Types and Expressions
Presentation transcript:

Getting Started 27 June 2016 Week 1, Day 1

Who am I? Name: Christopher Little Town: Cambridge Eats: Chips

Who are you?

Two double-lessons daily How we’re going to learn 11:00 13:00 9:00 Breaks at 10 : 00 and 11 : 45

How we’re going to learn 1. Listen (to me) 2. Confirm (for yourself) 3. Practice (makes perfect)

So much stuff! What are we going to learn?

Start Starting from total scratch Week 1 Setup Learning to Program Week 2 Web Programming Language Processing Week 3 Graphics Data Science Demo Day! Show off what you’ve learned! Zuzanna joins us

Plan for Day 1 1. Getting Started: Computer Setup What is programming? 2. Variables: Declaring and Assigning Types Arithmetic Operations

Computer Setup Getting Started

python.org Install Python github.com/Maximus5/ConEmu/releases (Windows Only) Install ConEmu tinyurl.com/ReachCompSci Bookmark Course Page sublimetext.com Install Sublime Text

What is a programming language? Getting Started

What is programming? Getting Started

Exercise 1.1 – A Tasty Algorithm 1. Look up a recipe for your favourite food 2. Rewrite this recipe into a step-by-step set of instructions for a slightly dim younger sibling 3. Convert your recipe into a flowchart ➡➡

The Python Interpreter

Exercise Learning Arithmetic Try out each of the following statements in the IDLE. How does each operator work? * 2 5 / 2 5 ** 2 5 // 2 5 % * 3 (5 + 2) * 3

Python Arithmetic Operators OperatorWhat it is + Addition - Subtraction * Multiplication / Division OperatorWhat it is // Integer division (round down) ** Exponent (power of) % Modulo (remainder) () Grouping

My First Function

Defining a function: def double(x): return x * 2 Using a function: double(4) # returns 8 double(-5) # returns -10

Exercise 1.3 – Your First Function Create a function which returns the next number in a sequence of your choice For example, for the sequence 0, 2, 4, 6, 8, … : myFunction(0) # returns 2 myFunction(2) # returns 4 myFunction(4) # returns 6

Exercise 1.3(b) – Your First Function Create a function which returns the nth number in a sequence of your choice For example, for the sequence 0, 2, 4, 6, 8, … : myFunction(0) # returns 0 myFunction(1) # returns 2 myFunction(2) # returns 4

Exercise 1.3(c) – Your First Function Create a function “ linear ” which takes three inputs - m, x and c - and calculates the y value at that point using the linear equation (y = mx + c)

Exercise 1.3(c) – Your First Function Create a function “ linear ” which takes three inputs - m, x and c - and calculates the y value at that point using the linear equation (y = mx + c) Extension: Create a similar function “ quadratic ” using the quadratic equation (y = ax 2 + bx + c)`

The Mighty print() Function

The Python Interpreter vs Python script files

Exercise 1.4 – A Short Biography Write a program that prints out the following on separate lines: 1. Your first name ‍ 2. Your age 3. How tall you are (in metres)

Types

Python Variable Types Python NameFull Name bool Boolean int Integer float Float str String

Variables

Declaring and Assigning Python Variables

Exercise 1.4(b) – A Short Biography Modify your biography program so that your details are stored in three variables. Print out the three lines as they were before.

The crafty input() function

Exercise 1.4(c) – Rewriting History Modify your biography program again. It must now: 1. Prompt the user for their name, age and favourite type of animal 2. Store these in a variable 3. Print on separate lines, as before

Exercise 1.4(d) – Rewriting History Modify your biography program again. It must now: 1. Prompt the user for their name, age and favourite type of animal 2. Store these in a variable 3. Print on separate lines, as before, but only using the print function once.

Day 1 Recap Python Basics: Installing What is programming? Arithmetic Operations Functions Interpreter vs Script files The print and input functions Types Variables

Now for the Challenges!

Exercise 1.5 – Fancy Receipts for a Fancy Shop Write a short program for generating nicely formatted receipts for a fancy boutique The user should be able to input 3 items, each with a short description and price, and these should be printed out after all three have been inputted

Exercise 1.5(b) – Fancyer Receipts for a Fancy Shop Write a short program for generating nicely formatted receipts for a fancy boutique The user should be able to input 3 items, each with a short description and price, and these should be printed out after all three have been inputted in a neat table, with the final total shown.

Exercise 1.6 – Quadratic Equation Solver Write a program that prompts the user for the variables a, b and c in the quadratic equation. Use the quadratic equation to find the two possible values for x such that ax 2 + bx + c = 0

Exercise 1.7 – Magic Mind Reader Write a program which: Asks the user to think of a number Asks the user to apply a series of arithmetic operations to their number, using another number as an example In the middle, cancel out the number with itself, so that the result is always the same. Amaze your user by telling them the resulting value!