Programming for Non-Programmers

Size: px
Start display at page:

Download "Programming for Non-Programmers"

Transcription

1 Programming for Non-Programmers Python Chapter 2 Source: Dilbert Agenda 6:00pm Lesson Begins 6:15pm First Pillow example up and running 6:30pm First class built 6:45pm Food & Challenge Problem 7:15pm Wrap up and Class Picture

2 Lesson Description In this lesson, we are going to take a closer look at functionality that makes our programs reusable. We are then going to create an application that can easily be extended upon. What you will learn: What is a package How to write a class Simple image processing Writing Reusable ( Modular ) code with Python In this lesson, we are going to dive deeper into some fundamental ideas in programming. We are going to concentrate on breaking our code into reusable chunks that make up a program. Remember in our first lesson we looked at functions as one way to do this. The second way we will reuse code is to build our own data structures, beyond using the primitive types we have used before (i.e., int, floats, strings). This allows not only us to reuse code, but to share these data structures with others who are trying to solve similar problems. The class structure also provides us a very nice way to organize our code. Note: On Learning to Program: I encourage you to consult multiple sources. As I write these notes, I cannot possibly cover every way to solve a problem. I find that myself as a learner, it is useful if I can see the same problem from multiple angles, explained with different analogies, and then try to talk about to myself and solve the problem. Additionally, if I have stared at the computer monitor for too many hours, it is time to take a break, stretch, and then try to solve the problem on paper before returning back to the editor. Getting Setup We are going to continue using the Idle editor provided by Python to run through some examples. We will continue to use some of the functionality given to us by the interactive Python interpreter, but will also be doing some bigger examples where we can type in code and be able to save our source file. That means we will want to be getting more comfortable with the Python Idle editor. Go ahead and type in idle& in your terminal now. If you are on a Windows machine, navigate to the start menu, and then Python/Idle. 1

3 Importing Packages (or Libraries ) We are going to start this lesson by installing the Python Imaging Library (PIL) The first thing we are going to type into idle is import PIL and then hit enter One of two things will now happen, you will either get a newline in the interpreter, or you will get some message along the lines of: Because I already have PIL installed, I did not get this error message, and demonstrated with another package the error I received. Note: What is a package? A package, which is also referred to as a library, is code that someone else has already written in Python or another programming language that we can import. This gives us additional functionality, and we are going to work on writing our own libraries that someone else could use in this lesson. If you received an error message like that, then this is how we are going to install PIL. There is a great set of instructions for installing here: On Mac or Linux: From the commandline, you can try to use pip if you have it installed. sudopipuninstallpil sudopipinstallpillow From the commandline, you may also use easy_install easy_installpillow If neither of those options work, you can download the.zip ( compressed archive from PyPI ) and then run in the commandline pythonsetup.pyinstall On Windows: Download and install the library from here: 2

4 Once PIL (Python Imaging Library) is installed, we can test again by typing import PIL, and we should get a newline. Our Project We are going to be performing some image processing tasks with the Python Imaging Library (PIL). Everyone s camera these days has many cool filters. You may have even heard of Instagram. I have just downloaded it, and at this time I have zero followers or photos, so perhaps I am not using it correctly. Lets use PIL to make a function that can perform an interesting transformation on the image. This will give us a small introduction to the Python Imaging Library (PIL), as well as a reminder of how to create functions. In order to use this function, we then use the command: Two test test.ppm images have been provided here for you to download: Note: There are also bmp images, which are a more common format provided. If you are on Windows, you may like to use the bmp images. If you re having trouble viewing the images (i.e. imagebuffer.show() is not working), then we will just save the file and open it up manually. The amended version would look like this: Now that we have created a function, lets run it on some of the sample images provided below. 3

5 Sample Input and Output Image Processing Image processing is a large field of study, and I want to motivate you with some samples of work on why it is interesting. To understand the function we wrote, we should also take a look at how color is represented on a computer. Image Processing examples in Science and Entertainment In order to motivate why image processing is cool, here are some examples in science and entertainment where it is used. Microarrays in Biology Paint editing tools ranging from MSPaint to Photoshop and Maya3D Computer Game Programming Instagram Face detection when you re tagging photos on Facebook Image tracking, such as on an X Box Kinect or on a security system Highlighting clusters in plots on a graph How does color work? Computers represent color with three primary colors that can be mixed to represent 255^3 total colors! The three components for graphical applications are usually red, green, and blue (although you may also be familiar with Cyan, Magenta, and Yellow as another color scheme). For each individual pixel on the computer screen, we then determine on a scale of how much we want that color channel (red, green, or blue) to contribute to the final color of that pixel. 4

6 For example: (255,0,0) is a tuple that makes a pixel all red, because we are filling in the red value to its maximum. (0,255,0) is a tuple that makes a pixel all green, because we are filling in the green value to its maximum. (0,0,255) is a tuple that makes a pixel all blue, because we are filling in the blue value to its maximum. Now that we have some intuition about images, we can begin to build our own class. Building our First Class If we want to write more filters on our image, then we can write more functions. We can even group these together under what is called a class. Classes A class is Python s way to let us build our own data types. Because we have defined our own data type, this is called a user defined data type. More simply, we can think of a class as a collection of variables and functions that operate within an isolated environment. The variables and functions are stored into one spot and separated from other code (This is an example of encapsulation). A class consists of three parts in Python: 1. The name of the class That is, the name of our new data type. 2. The member variables Variables we need to store data and are local (belong and are accessible only to this class). 3. The member functions Functions that allow us to operate on this object. Important Programming Lingo: When one instantiates and makes use of the class, it is known as an instance of a class or an object. This is an important distinguishment, because we can have multiple instances of a class. Motivation: A Short Note on Object-Oriented Programming Python is what is known as an Object Oriented Programming language. Object Oriented programming languages evolved from procedural programming. Procedural programming is a way for writing programs such that they execute instructions in a fairly linear order from top to bottom. When we wrote our first challenge problem the guessing game, that was considered a procedural program, in that its execution was very linear, and there were no objects or classes. 5

7 Our First Class Our first class is going to be named CSLOLFilter. That is the name of the data type we are creating. Every class needs what is called a constructor, so we are going to build that first. We are going to be working in Python s idle editor for this example. Please open a new file up, and save it with a.py file extension (e.g. myimageprocessing.py ). First, we want to name our class. And we use the keyword class and follow it with a name and a semi colon. Remember in our first lesson, we talked a lot about data representation. What this class is, is a way to represent data, with a new data type called CSLOLFilter. Within our datatype, we can call methods. Earlier we saw in the Pillow library, we say the dot operator from the images. We are going to make our own method, but first we must make an initial method that is called. This initial method sets up our object if there is any work that needs to be done. In this case, our initial method init (with two underscores on both sides), we declare similar to how we have made our own functions. Notice one thing that is different. The first argument is a keyword called self. This means that this method is acting on a specific instance of our class. It s pythons way of saying, okay, we made an object somewhere in our program, now I want to make sure this function specifically acts on the one object we made, and not all objects we made in the future. Take a minute to let that sink in. The second argument will be for a file that we provide which will be an image. The body of our init function will read as below. Note we once again see the word self here. In this context this means in Python speak, Hey Python, this object owns some variable called filepath, and we want to store it within this object. 6

8 So anytime we want to refer to the variable filepath within our class, we once again use the word self. The next lines open a file, store the original pixels, print out how the image is formatted, and then we display the image to the screen. Here is the full code listing. Once we have written this code, we can then test it out. Just to make the point clear that this is an instance of our class, we are going to create a variable called object_instance and instantiate it with our CSLOLFilter which takes one argument (even though our constructor has two arguments, remember that one was self, and Python just uses this information internally). We should once again get thes same input with our output. Sample Input and Output Okay, now we will move one step further and create a filter for this image. 7

9 Creating our first filter We are going to create a redfilter that filters out all of the green and blue light from our image. Within our CSLOLFilter class, we will define a new method just like our constructor. We will then once again retrieve the images width and height. Notice that we do this in one line. It is worth noting that the width and height are stored in imagebuffer (which is our name for the image we loaded,), and has a tuple called size that internally is (width, height). Because that itself is a tuple, or a list with two items, we can access them both at once in a single line. Once we have got the dimensions to the image, we use those variables to loop through the images pixel data, and then we modify each individual pixels color. We haven t previously seen a nested for loop, but this is a convient way to look through the images data. We are looking through one row of information (the width) at a time, and then incrementing along the y axis of the image, and scanning that row of information. The lines containing getpixel and putpixel are simply retrieving a tuple of color values (as we previously discussed, r, g, and b), and then modifying that tuple with a new value. Finally we show our image. 8

10 Here is the full code listing for the method Proceed to the next page to see how our class has formed in its entirety. You can also download the full source from here: 9

11 Now lets call our image filter function, and you should get a new output. 10

12 New Output Challenge Problem - Image Processing For our challenge problem, you will be adding new functions to our class to create your own filters. I have some suggestions for common filters and ideas provided below. A blue color filter A green color filter Invert the colors Make the image a grayscale to grayscale.htm Multiple r * , g* and b * and then divide the sum by 3 Will a straight multiplication work, or will you need to convert to integer? Build another filter that makes the pixels black or white based on this threshold. Create a border around the image Highlight colors in a certain color range Brighten the image by multiplying the r, g, and b values Darken the image by dividing the r, g, and b values 11

13 Demystifying some of Python Image Library (PIL) As an exercise, it s important to understand some of what is going on under the hood of the library. Something to note is that we can never make any assumptions about what a library is actually doing, however, as an exercise I want you to at least understand and get some new terminology under your belt that we have not previously discussed. It s also a good exercise to do, if you think you can implement something better in this library. Here is a look at some of the functions: What about a Data Science Example? Image processing is a wide field as we have previously discussed. A library like Pillow is very low level, and can be built upon to do interesting things. One may imagine how we would build more kinds of filters on images for feature detection (e.g. face detection and object detection). It will be worth it for us in our next sections to look at other Python libraries such as: Matplotlib Performs plots, useful for finding clusters in data Numpy Perform more transformations on the data. Opencv Performs image tracking Going further on the Image Processing Lets continue to combine the constructs we have used from previous labs. Use conditionals to make thresholds on certain images. Try to find blocks that are the same color and fill them in with a new one (flood filter) (Advanced) Try to perform edge detection How would you try to tackle this problem? Thinking like a computer scientist, think about how you would shrink your search space? (Super Advanced) Try to perform background elimination. 12

14 What s to come in the future of CSLOL? (Lessons below in Python) Tentative Lesson 3 Lists and List Comprehension fun Do something with loading csv file and matplotlib Classical searching algorithms Tentative Lesson 4 Building android apps in Python OpenCV image tracking, face detection Tentative Lesson 5 Do something with Pygame Do something with threading Building web apps Building a forms application with tk Potentially with SQL or a database Cheat sheet for gray filter 13

In our first lecture on sets and set theory, we introduced a bunch of new symbols and terminology.

In our first lecture on sets and set theory, we introduced a bunch of new symbols and terminology. Guide to and Hi everybody! In our first lecture on sets and set theory, we introduced a bunch of new symbols and terminology. This guide focuses on two of those symbols: and. These symbols represent concepts

More information

Dr. Scheme evaluates expressions so we will start by using the interactions window and asking Dr. Scheme to evaluate some expressions.

Dr. Scheme evaluates expressions so we will start by using the interactions window and asking Dr. Scheme to evaluate some expressions. 1.0 Expressions Dr. Scheme evaluates expressions so we will start by using the interactions window and asking Dr. Scheme to evaluate some expressions. Numbers are examples of primitive expressions, meaning

More information

CMSC/BIOL 361: Emergence Cellular Automata: Introduction to NetLogo

CMSC/BIOL 361: Emergence Cellular Automata: Introduction to NetLogo Disclaimer: To get you oriented to the NetLogo platform, I ve put together an in-depth step-by-step walkthrough of a NetLogo simulation and the development environment in which it is presented. For those

More information

CMSC 150 Lab 8, Part II: Little PhotoShop of Horrors, Part Deux 10 Nov 2015

CMSC 150 Lab 8, Part II: Little PhotoShop of Horrors, Part Deux 10 Nov 2015 CMSC 150 Lab 8, Part II: Little PhotoShop of Horrors, Part Deux 10 Nov 2015 By now you should have completed the Open/Save/Quit portion of the menu options. Today we are going to finish implementing the

More information

6.001 Notes: Section 15.1

6.001 Notes: Section 15.1 6.001 Notes: Section 15.1 Slide 15.1.1 Our goal over the next few lectures is to build an interpreter, which in a very basic sense is the ultimate in programming, since doing so will allow us to define

More information

Week - 01 Lecture - 04 Downloading and installing Python

Week - 01 Lecture - 04 Downloading and installing Python Programming, Data Structures and Algorithms in Python Prof. Madhavan Mukund Department of Computer Science and Engineering Indian Institute of Technology, Madras Week - 01 Lecture - 04 Downloading and

More information

6.001 Notes: Section 17.5

6.001 Notes: Section 17.5 6.001 Notes: Section 17.5 Slide 17.5.1 Now, let's look at one example in which changing the evaluation model allows us to explore a very different kind of computational problem. Our goal is to show how

More information

(Refer Slide Time: 00:26)

(Refer Slide Time: 00:26) Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute Technology, Madras Module 07 Lecture 07 Contents Repetitive statements

More information

Slide 1 CS 170 Java Programming 1 Multidimensional Arrays Duration: 00:00:39 Advance mode: Auto

Slide 1 CS 170 Java Programming 1 Multidimensional Arrays Duration: 00:00:39 Advance mode: Auto CS 170 Java Programming 1 Working with Rows and Columns Slide 1 CS 170 Java Programming 1 Duration: 00:00:39 Create a multidimensional array with multiple brackets int[ ] d1 = new int[5]; int[ ][ ] d2;

More information

L E S S O N 2 Background

L E S S O N 2 Background Flight, Naperville Central High School, Naperville, Ill. No hard hat needed in the InDesign work area Once you learn the concepts of good page design, and you learn how to use InDesign, you are limited

More information

(Ca...

(Ca... 1 of 8 9/7/18, 1:59 PM Getting started with 228 computational exercises Many physics problems lend themselves to solution methods that are best implemented (or essentially can only be implemented) with

More information

: Intro Programming for Scientists and Engineers Final Exam

: Intro Programming for Scientists and Engineers Final Exam Final Exam Page 1 of 6 600.112: Intro Programming for Scientists and Engineers Final Exam Peter H. Fröhlich phf@cs.jhu.edu December 20, 2012 Time: 40 Minutes Start here: Please fill in the following important

More information

Decisions, Decisions. Testing, testing C H A P T E R 7

Decisions, Decisions. Testing, testing C H A P T E R 7 C H A P T E R 7 In the first few chapters, we saw some of the basic building blocks of a program. We can now make a program with input, processing, and output. We can even make our input and output a little

More information

(Refer Slide Time: 1:27)

(Refer Slide Time: 1:27) Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture 1 Introduction to Data Structures and Algorithms Welcome to data

More information

Art, Nature, and Patterns Introduction

Art, Nature, and Patterns Introduction Art, Nature, and Patterns Introduction to LOGO Describing patterns with symbols This tutorial is designed to introduce you to some basic LOGO commands as well as two fundamental and powerful principles

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #43. Multidimensional Arrays

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #43. Multidimensional Arrays Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #43 Multidimensional Arrays In this video will look at multi-dimensional arrays. (Refer Slide Time: 00:03) In

More information

CS1114: Matlab Introduction

CS1114: Matlab Introduction CS1114: Matlab Introduction 1 Introduction The purpose of this introduction is to provide you a brief introduction to the features of Matlab that will be most relevant to your work in this course. Even

More information

1 Check it out! : Fundamentals of Programming and Computer Science, Fall Homework 3 Programming: Image Processing

1 Check it out! : Fundamentals of Programming and Computer Science, Fall Homework 3 Programming: Image Processing 15-112 Homework 3 Page 1 of 5 15-112: Fundamentals of Programming and Computer Science, Fall 2017 Homework 3 Programming: Image Processing Due: Tuesday, September 26, 2017 by 22:00 This programming homework

More information

6.001 Notes: Section 6.1

6.001 Notes: Section 6.1 6.001 Notes: Section 6.1 Slide 6.1.1 When we first starting talking about Scheme expressions, you may recall we said that (almost) every Scheme expression had three components, a syntax (legal ways of

More information

Introduction to Programming with JES

Introduction to Programming with JES Introduction to Programming with JES Titus Winters & Josef Spjut October 6, 2005 1 Introduction First off, welcome to UCR, and congratulations on becoming a Computer Engineering major. Excellent choice.

More information

Would you like to put an image on your index page? There are several ways to do this and I will start with the easy way.

Would you like to put an image on your index page? There are several ways to do this and I will start with the easy way. Home Frontpage & Other Tutorials Dreamweaver Tutorial Contact Images and Tables Would you like to put an image on your index page? There are several ways to do this and I will start with the easy way.

More information

AGENT123. Full Q&A and Tutorials Table of Contents. Website IDX Agent Gallery Step-by-Step Tutorials

AGENT123. Full Q&A and Tutorials Table of Contents. Website IDX Agent Gallery Step-by-Step Tutorials AGENT123 Full Q&A and Tutorials Table of Contents Website IDX Agent Gallery Step-by-Step Tutorials WEBSITE General 1. How do I log into my website? 2. How do I change the Meta Tags on my website? 3. How

More information

6.001 Notes: Section 1.1

6.001 Notes: Section 1.1 6.001 Notes: Section 1.1 Slide 1.1.1 This first thing we need to do is discuss the focus of 6.001. What is this course all about? This seems quite obvious -- this is a course about computer science. But

More information

DOING MORE WITH EXCEL: MICROSOFT OFFICE 2013

DOING MORE WITH EXCEL: MICROSOFT OFFICE 2013 DOING MORE WITH EXCEL: MICROSOFT OFFICE 2013 GETTING STARTED PAGE 02 Prerequisites What You Will Learn MORE TASKS IN MICROSOFT EXCEL PAGE 03 Cutting, Copying, and Pasting Data Basic Formulas Filling Data

More information

Select the ONE best answer to the question from the choices provided.

Select the ONE best answer to the question from the choices provided. FINAL EXAM Introduction to Computer Science UAlbany, Coll. Comp. Info ICSI 201 Spring 2013 Questions explained for post-exam review and future session studying. Closed book/notes with 1 paper sheet of

More information

ARTIFICIAL INTELLIGENCE AND PYTHON

ARTIFICIAL INTELLIGENCE AND PYTHON ARTIFICIAL INTELLIGENCE AND PYTHON DAY 1 STANLEY LIANG, LASSONDE SCHOOL OF ENGINEERING, YORK UNIVERSITY WHAT IS PYTHON An interpreted high-level programming language for general-purpose programming. Python

More information

MCS 2514 Fall 2012 Programming Assignment 3 Image Processing Pointers, Class & Dynamic Data Due: Nov 25, 11:59 pm.

MCS 2514 Fall 2012 Programming Assignment 3 Image Processing Pointers, Class & Dynamic Data Due: Nov 25, 11:59 pm. MCS 2514 Fall 2012 Programming Assignment 3 Image Processing Pointers, Class & Dynamic Data Due: Nov 25, 11:59 pm. This project is called Image Processing which will shrink an input image, convert a color

More information

CISC 1600 Lecture 3.1 Introduction to Processing

CISC 1600 Lecture 3.1 Introduction to Processing CISC 1600 Lecture 3.1 Introduction to Processing Topics: Example sketches Drawing functions in Processing Colors in Processing General Processing syntax Processing is for sketching Designed to allow artists

More information

CSC 101: Lab Manual#11 Programming Turtle Graphics in Python Lab due date: 5:00pm, day after lab session

CSC 101: Lab Manual#11 Programming Turtle Graphics in Python Lab due date: 5:00pm, day after lab session CSC 101: Lab Manual#11 Programming Turtle Graphics in Python Lab due date: 5:00pm, day after lab session Purpose: The purpose of this lab is to get a little introduction to the process of computer programming

More information

CS Problem Solving and Object-Oriented Programming

CS Problem Solving and Object-Oriented Programming CS 101 - Problem Solving and Object-Oriented Programming Lab 5 - Draw a Penguin Due: October 28/29 Pre-lab Preparation Before coming to lab, you are expected to have: Read Bruce chapters 1-3 Introduction

More information

Module 10A Lecture - 20 What is a function? Why use functions Example: power (base, n)

Module 10A Lecture - 20 What is a function? Why use functions Example: power (base, n) Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Module 10A Lecture - 20 What is a function?

More information

Introduction to Python Part 2

Introduction to Python Part 2 Introduction to Python Part 2 v0.2 Brian Gregor Research Computing Services Information Services & Technology Tutorial Outline Part 2 Functions Tuples and dictionaries Modules numpy and matplotlib modules

More information

CME 193: Introduction to Scientific Python Lecture 1: Introduction

CME 193: Introduction to Scientific Python Lecture 1: Introduction CME 193: Introduction to Scientific Python Lecture 1: Introduction Nolan Skochdopole stanford.edu/class/cme193 1: Introduction 1-1 Contents Administration Introduction Basics Variables Control statements

More information

Once you define a new command, you can try it out by entering the command in IDLE:

Once you define a new command, you can try it out by entering the command in IDLE: 1 DEFINING NEW COMMANDS In the last chapter, we explored one of the most useful features of the Python programming language: the use of the interpreter in interactive mode to do on-the-fly programming.

More information

CSS worksheet. JMC 105 Drake University

CSS worksheet. JMC 105 Drake University CSS worksheet JMC 105 Drake University 1. Download the css-site.zip file from the class blog and expand the files. You ll notice that you have an images folder with three images inside and an index.html

More information

CS1114: Matlab Introduction

CS1114: Matlab Introduction CS1114: Matlab Introduction 1 Introduction The purpose of this introduction is to provide you a brief introduction to the features of Matlab that will be most relevant to your work in this course. Even

More information

[ the academy_of_code] Senior Beginners

[ the academy_of_code] Senior Beginners [ the academy_of_code] Senior Beginners 1 Drawing Circles First step open Processing Open Processing by clicking on the Processing icon (that s the white P on the blue background your teacher will tell

More information

CS 465 Program 5: Ray II

CS 465 Program 5: Ray II CS 465 Program 5: Ray II out: Friday 2 November 2007 due: Saturday 1 December 2007 Sunday 2 December 2007 midnight 1 Introduction In the first ray tracing assignment you built a simple ray tracer that

More information

c122sep2214.notebook September 22, 2014

c122sep2214.notebook September 22, 2014 This is using the border attribute next we will look at doing the same thing with CSS. 1 Validating the page we just saw. 2 This is a warning that recommends I use CSS. 3 This caused a warning. 4 Now I

More information

DOING MORE WITH EXCEL: MICROSOFT OFFICE 2010

DOING MORE WITH EXCEL: MICROSOFT OFFICE 2010 DOING MORE WITH EXCEL: MICROSOFT OFFICE 2010 GETTING STARTED PAGE 02 Prerequisites What You Will Learn MORE TASKS IN MICROSOFT EXCEL PAGE 03 Cutting, Copying, and Pasting Data Filling Data Across Columns

More information

Making use of other Applications

Making use of other Applications AppGameKit 2 Collision Using Arrays Making use of other Applications Although we need game software to help makes games for modern devices, we should not exclude the use of other applications to aid the

More information

Image Processing (1) Basic Concepts and Introduction of OpenCV

Image Processing (1) Basic Concepts and Introduction of OpenCV Intelligent Control Systems Image Processing (1) Basic Concepts and Introduction of OpenCV Shingo Kagami Graduate School of Information Sciences, Tohoku University swk(at)ic.is.tohoku.ac.jp http://www.ic.is.tohoku.ac.jp/ja/swk/

More information

CMPSCI 119 LAB #2 Greebles / Anime Eyes Professor William T. Verts

CMPSCI 119 LAB #2 Greebles / Anime Eyes Professor William T. Verts CMPSCI 119 LAB #2 Greebles / Anime Eyes Professor William T. Verts The goal of this Python programming assignment is to write your own code inside a provided program framework, with some new graphical

More information

C++ & Object Oriented Programming Concepts The procedural programming is the standard approach used in many traditional computer languages such as BASIC, C, FORTRAN and PASCAL. The procedural programming

More information

CS 1110, LAB 3: MODULES AND TESTING First Name: Last Name: NetID:

CS 1110, LAB 3: MODULES AND TESTING   First Name: Last Name: NetID: CS 1110, LAB 3: MODULES AND TESTING http://www.cs.cornell.edu/courses/cs11102013fa/labs/lab03.pdf First Name: Last Name: NetID: The purpose of this lab is to help you better understand functions, and to

More information

SPRITES Moving Two At the Same Using Game State

SPRITES Moving Two At the Same Using Game State If you recall our collision detection lesson, you ll likely remember that you couldn t move both sprites at the same time unless you hit a movement key for each at exactly the same time. Why was that?

More information

Using the API: Introductory Graphics Java Programming 1 Lesson 8

Using the API: Introductory Graphics Java Programming 1 Lesson 8 Using the API: Introductory Graphics Java Programming 1 Lesson 8 Using Java Provided Classes In this lesson we'll focus on using the Graphics class and its capabilities. This will serve two purposes: first

More information

IMAGE PROCESSING OVERVIEW

IMAGE PROCESSING OVERVIEW IMAGE PROCESSING OVERVIEW During this section of the workshop, participants will have an opportunity to learn the fundamentals of image processing. The concepts explored in this section have familiar applications

More information

Creating Your Web Site

Creating Your Web Site Creating Your Web Site Students who are serious about wanting to be writers must create their own web sites to display their work. This is what professionals want to see an easy place to access your work

More information

There are four (4) skills every Drupal editor needs to master:

There are four (4) skills every Drupal editor needs to master: There are four (4) skills every Drupal editor needs to master: 1. Create a New Page / Edit an existing page. This entails adding text and formatting the content properly. 2. Adding an image to a page.

More information

The first thing we ll need is some numbers. I m going to use the set of times and drug concentration levels in a patient s bloodstream given below.

The first thing we ll need is some numbers. I m going to use the set of times and drug concentration levels in a patient s bloodstream given below. Graphing in Excel featuring Excel 2007 1 A spreadsheet can be a powerful tool for analyzing and graphing data, but it works completely differently from the graphing calculator that you re used to. If you

More information

Python for Earth Scientists

Python for Earth Scientists Python for Earth Scientists Andrew Walker andrew.walker@bris.ac.uk Python is: A dynamic, interpreted programming language. Python is: A dynamic, interpreted programming language. Data Source code Object

More information

BASICS OF PIXLR EDITOR

BASICS OF PIXLR EDITOR BASICS OF PIXLR EDITOR Pixlr is a website which you can edit your images professionally. It is a cloud cased system and founded in Sweden. It is similar to Photoshop (but it s free to use online) and you

More information

Making Tables and Graphs with Excel. The Basics

Making Tables and Graphs with Excel. The Basics Making Tables and Graphs with Excel The Basics Where do my IV and DV go? Just like you would create a data table on paper, your IV goes in the leftmost column and your DV goes to the right of the IV Enter

More information

CSC 101: PreLab Reading for Lab #4 More HTML (some of this reading on Tables and Images are based on previous writings of Prof William Turkett)

CSC 101: PreLab Reading for Lab #4 More HTML (some of this reading on Tables and Images are based on previous writings of Prof William Turkett) CSC 101: PreLab Reading for Lab #4 More HTML (some of this reading on Tables and Images are based on previous writings of Prof William Turkett) Purpose: The purpose of this pre-lab is to provide you with

More information

Hello World! Computer Programming for Kids and Other Beginners. Chapter 1. by Warren Sande and Carter Sande. Copyright 2009 Manning Publications

Hello World! Computer Programming for Kids and Other Beginners. Chapter 1. by Warren Sande and Carter Sande. Copyright 2009 Manning Publications Hello World! Computer Programming for Kids and Other Beginners by Warren Sande and Carter Sande Chapter 1 Copyright 2009 Manning Publications brief contents Preface xiii Acknowledgments xix About this

More information

Introduction to: Computers & Programming: Review prior to 1 st Midterm

Introduction to: Computers & Programming: Review prior to 1 st Midterm Introduction to: Computers & Programming: Review prior to 1 st Midterm Adam Meyers New York University Summary Some Procedural Matters Summary of what you need to Know For the Test and To Go Further in

More information

O Hailey: Chapter 3 Bonus Materials

O Hailey: Chapter 3 Bonus Materials O Hailey: Chapter 3 Bonus Materials Maya s Toon Line For those familiar with toon lines in Maya, you may skip ahead past this section. Those not familiar might find it useful to understand the basics of

More information

Introduction to Game Programming Lesson 4 Lecture Notes

Introduction to Game Programming Lesson 4 Lecture Notes Introduction to Game Programming Lesson 4 Lecture Notes Learning Objectives: Following this lecture, the student should be able to: Define frame rate List the factors that affect the amount of time a game

More information

CSE2003: System Programming Final Exam. (Spring 2009)

CSE2003: System Programming Final Exam. (Spring 2009) CSE2003: System Programming Final Exam. (Spring 2009) 3:00PM 5:00PM, June 17, 2009. Instructor: Jin Soo Kim Student ID: Name: 1. Write the full name of the following acronym. (25 points) (1) GNU ( ) (2)

More information

Day 1: Introduction to MATLAB and Colorizing Images CURIE Academy 2015: Computational Photography Sign-Off Sheet

Day 1: Introduction to MATLAB and Colorizing Images CURIE Academy 2015: Computational Photography Sign-Off Sheet Day 1: Introduction to MATLAB and Colorizing Images CURIE Academy 2015: Computational Photography Sign-Off Sheet NAME: NAME: Part 1.1 Part 1.2 Part 1.3 Part 2.1 Part 2.2 Part 3.1 Part 3.2 Sign-Off Milestone

More information

nostarch.com/pfk For bulk orders, please contact us at

nostarch.com/pfk For bulk orders, please contact us at nostarch.com/pfk For bulk orders, please contact us at sales@nostarch.com. Teacher: Date/Period: Subject: Python Programming Class: Topic: #1 - Getting Started Duration: Up to 50 min. Objectives: Install

More information

Introduction to Machine Learning Prof. Anirban Santara Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Introduction to Machine Learning Prof. Anirban Santara Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Introduction to Machine Learning Prof. Anirban Santara Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture 14 Python Exercise on knn and PCA Hello everyone,

More information

(Refer Slide Time: 00:03:51)

(Refer Slide Time: 00:03:51) Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 17 Scan Converting Lines, Circles and Ellipses Hello and welcome everybody

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #17. Loops: Break Statement

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #17. Loops: Break Statement Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #17 Loops: Break Statement (Refer Slide Time: 00:07) In this session we will see one more feature that is present

More information

Getting Started. Excerpted from Hello World! Computer Programming for Kids and Other Beginners

Getting Started. Excerpted from Hello World! Computer Programming for Kids and Other Beginners Getting Started Excerpted from Hello World! Computer Programming for Kids and Other Beginners EARLY ACCESS EDITION Warren D. Sande and Carter Sande MEAP Release: May 2008 Softbound print: November 2008

More information

CS61A Notes Week 1A: Basics, order of evaluation, special forms, recursion

CS61A Notes Week 1A: Basics, order of evaluation, special forms, recursion CS61A Notes Week 1A: Basics, order of evaluation, special forms, recursion Assorted Scheme Basics 1. The ( is the most important character in Scheme. If you have coded in other languages such as C or Java,

More information

Chapter 5 Methods. public class FirstMethod { public static void main(string[] args) { double x= -2.0, y; for (int i = 1; i <= 5; i++ ) { y = f( x );

Chapter 5 Methods. public class FirstMethod { public static void main(string[] args) { double x= -2.0, y; for (int i = 1; i <= 5; i++ ) { y = f( x ); Chapter 5 Methods Sections Pages Review Questions Programming Exercises 5.1 5.11 142 166 1 18 2 22 (evens), 30 Method Example 1. This is of a main() method using a another method, f. public class FirstMethod

More information

Part 6b: The effect of scale on raster calculations mean local relief and slope

Part 6b: The effect of scale on raster calculations mean local relief and slope Part 6b: The effect of scale on raster calculations mean local relief and slope Due: Be done with this section by class on Monday 10 Oct. Tasks: Calculate slope for three rasters and produce a decent looking

More information

5 R1 The one green in the same place so either of these could be green.

5 R1 The one green in the same place so either of these could be green. Page: 1 of 20 1 R1 Now. Maybe what we should do is write out the cases that work. We wrote out one of them really very clearly here. [R1 takes out some papers.] Right? You did the one here um where you

More information

CMPSCI 119 LAB #2 Anime Eyes Professor William T. Verts

CMPSCI 119 LAB #2 Anime Eyes Professor William T. Verts CMPSCI 119 LAB #2 Anime Eyes Professor William T. Verts The goal of this Python programming assignment is to write your own code inside a provided program framework, with some new graphical and mathematical

More information

E-Business Systems 1 INTE2047 Lab Exercises. Lab 5 Valid HTML, Home Page & Editor Tables

E-Business Systems 1 INTE2047 Lab Exercises. Lab 5 Valid HTML, Home Page & Editor Tables Lab 5 Valid HTML, Home Page & Editor Tables Navigation Topics Covered Server Side Includes (SSI) PHP Scripts menu.php.htaccess assessment.html labtasks.html Software Used: HTML Editor Background Reading:

More information

Languages. Solve problems using a computer, give the computer instructions. Remember our diaper-changing exercise?

Languages. Solve problems using a computer, give the computer instructions. Remember our diaper-changing exercise? Languages Solve problems using a computer, give the computer instructions. Remember our diaper-changing exercise? Talk the talk Speak its language High-level: Python, C++, Java Low-level: machine language,

More information

Lab 1: Silver Dollar Game 1 CSCI 2101B Fall 2018

Lab 1: Silver Dollar Game 1 CSCI 2101B Fall 2018 Lab 1: Silver Dollar Game 1 CSCI 2101B Fall 2018 Due: Tuesday, September 18, 11:59 pm Collaboration Policy: Level 1 (review full policy for details) Group Policy: Individual This lab will give you experience

More information

GETTING STARTED GUIDE

GETTING STARTED GUIDE SETUP GETTING STARTED GUIDE About Benchmark Email Helping you turn your email list into relationships and sales. Your email list is your most valuable marketing asset. Benchmark Email helps marketers short

More information

SETTING UP A. chapter

SETTING UP A. chapter 1-4283-1960-3_03_Rev2.qxd 5/18/07 8:24 PM Page 1 chapter 3 SETTING UP A DOCUMENT 1. Create a new document. 2. Create master pages. 3. Apply master pages to document pages. 4. Place text and thread text.

More information

THE IF STATEMENT. The if statement is used to check a condition: if the condition is true, we run a block

THE IF STATEMENT. The if statement is used to check a condition: if the condition is true, we run a block THE IF STATEMENT The if statement is used to check a condition: if the condition is true, we run a block of statements (called the if-block), elsewe process another block of statements (called the else-block).

More information

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA 1 TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared

More information

GLY Geostatistics Fall Lecture 2 Introduction to the Basics of MATLAB. Command Window & Environment

GLY Geostatistics Fall Lecture 2 Introduction to the Basics of MATLAB. Command Window & Environment GLY 6932 - Geostatistics Fall 2011 Lecture 2 Introduction to the Basics of MATLAB MATLAB is a contraction of Matrix Laboratory, and as you'll soon see, matrices are fundamental to everything in the MATLAB

More information

Computer and Programming: Lab 1

Computer and Programming: Lab 1 01204111 Computer and Programming: Lab 1 Name ID Section Goals To get familiar with Wing IDE and learn common mistakes with programming in Python To practice using Python interactively through Python Shell

More information

CS 100 Python commands, computing concepts, and algorithmic approaches for final Fall 2015

CS 100 Python commands, computing concepts, and algorithmic approaches for final Fall 2015 CS 100 Python commands, computing concepts, and algorithmic approaches for final Fall 2015 These pages will NOT BE INCLUDED IN THE MIDTERM. print - Displays a value in the command area - Examples: - print

More information

Lesson 10A OOP Fundamentals. By John B. Owen All rights reserved 2011, revised 2014

Lesson 10A OOP Fundamentals. By John B. Owen All rights reserved 2011, revised 2014 Lesson 10A OOP Fundamentals By John B. Owen All rights reserved 2011, revised 2014 Table of Contents Objectives Definition Pointers vs containers Object vs primitives Constructors Methods Object class

More information

Visual C# Program: Simple Game 3

Visual C# Program: Simple Game 3 C h a p t e r 6C Visual C# Program: Simple Game 3 In this chapter, you will learn how to use the following Visual C# Application functions to World Class standards: Opening Visual C# Editor Beginning a

More information

If Statements, For Loops, Functions

If Statements, For Loops, Functions Fundamentals of Programming If Statements, For Loops, Functions Table of Contents Hello World Types of Variables Integers and Floats String Boolean Relational Operators Lists Conditionals If and Else Statements

More information

Workshop with ROCKWOOL editors. Helle Jensen, Senior ux consultant

Workshop with ROCKWOOL editors. Helle Jensen, Senior ux consultant Workshop with ROCKWOOL editors Helle Jensen, Senior ux consultant Agenda 1. Intro to UX and customer journeys 2. Intro to web content 3. Intro to blocks in EpiServer 4. Content guidelines 5. Exercise:

More information

1 Getting started with Processing

1 Getting started with Processing cis3.5, spring 2009, lab II.1 / prof sklar. 1 Getting started with Processing Processing is a sketch programming tool designed for use by non-technical people (e.g., artists, designers, musicians). For

More information

EPISODE 23: HOW TO GET STARTED WITH MAILCHIMP

EPISODE 23: HOW TO GET STARTED WITH MAILCHIMP EPISODE 23: HOW TO GET STARTED WITH MAILCHIMP! 1 of! 26 HOW TO GET STARTED WITH MAILCHIMP Want to play a fun game? Every time you hear the phrase email list take a drink. You ll be passed out in no time.

More information

Solve a Maze via Search

Solve a Maze via Search Northeastern University CS4100 Artificial Intelligence Fall 2017, Derbinsky Solve a Maze via Search By the end of this project you will have built an application that applies graph search to solve a maze,

More information

+ Inheritance. Sometimes we need to create new more specialized types that are similar to types we have already created.

+ Inheritance. Sometimes we need to create new more specialized types that are similar to types we have already created. + Inheritance + Inheritance Classes that we design in Java can be used to model some concept in our program. For example: Pokemon a = new Pokemon(); Pokemon b = new Pokemon() Sometimes we need to create

More information

Chapter 2: Objects, classes and factories

Chapter 2: Objects, classes and factories Chapter 2 Objects, classes and factories By the end of this chapter you will have the essential knowledge to start our big project writing the MyPong application. This chapter is important for another

More information

Lab 1 Introduction to R

Lab 1 Introduction to R Lab 1 Introduction to R Date: August 23, 2011 Assignment and Report Due Date: August 30, 2011 Goal: The purpose of this lab is to get R running on your machines and to get you familiar with the basics

More information

5.1. Examples: Going beyond Sequence

5.1. Examples: Going beyond Sequence Chapter 5. Selection In Chapter 1 we saw that algorithms deploy sequence, selection and repetition statements in combination to specify computations. Since that time, however, the computations that we

More information

Module 10: Imperative Programming, Modularization, and The Future

Module 10: Imperative Programming, Modularization, and The Future Module 10: Imperative Programming, Modularization, and The Future If you have not already, make sure you Read How to Design Programs Sections 18. 1 CS 115 Module 10: Imperative Programming, Modularization,

More information

GIS 4653/5653: Spatial Programming and GIS. More Python: Statements, Types, Functions, Modules, Classes

GIS 4653/5653: Spatial Programming and GIS. More Python: Statements, Types, Functions, Modules, Classes GIS 4653/5653: Spatial Programming and GIS More Python: Statements, Types, Functions, Modules, Classes Statement Syntax The if-elif-else statement Indentation and and colons are important Parentheses and

More information

Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller

Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller Table of Contents Introduction!... 1 Part 1: Entering Data!... 2 1.a: Typing!... 2 1.b: Editing

More information

Simple Java Programming Constructs 4

Simple Java Programming Constructs 4 Simple Java Programming Constructs 4 Course Map In this module you will learn the basic Java programming constructs, the if and while statements. Introduction Computer Principles and Components Software

More information

CSE : Python Programming

CSE : Python Programming CSE 399-004: Python Programming Lecture 2: Data, Classes, and Modules January 22, 2007 http://www.seas.upenn.edu/~cse39904/ Administrative things Teaching assistant Brian Summa (bsumma @ seas.upenn.edu)

More information

HTML/CSS Lesson Plans

HTML/CSS Lesson Plans HTML/CSS Lesson Plans Course Outline 8 lessons x 1 hour Class size: 15-25 students Age: 10-12 years Requirements Computer for each student (or pair) and a classroom projector Pencil and paper Internet

More information

Term Definition Introduced in: This option, located within the View tab, provides a variety of options to choose when sorting and grouping Arrangement

Term Definition Introduced in: This option, located within the View tab, provides a variety of options to choose when sorting and grouping Arrangement 60 Minutes of Outlook Secrets Term Definition Introduced in: This option, located within the View tab, provides a variety of options to choose when sorting and grouping Arrangement messages. Module 2 Assign

More information

InDesign Part II. Create a Library by selecting File, New, Library. Save the library with a unique file name.

InDesign Part II. Create a Library by selecting File, New, Library. Save the library with a unique file name. InDesign Part II Library A library is a file and holds a collection of commonly used objects. A library is a file (extension.indl) and it is stored on disk. A library file can be open at any time while

More information