CSci 127: Introduction to Computer Science

Similar documents
SSR SSR SSR SSR

AN RPM to TACH Counts Conversion. 1 Preface. 2 Audience. 3 Overview. 4 References

Collision Avoidance System CAS-M light. Manual

Rotel RSP-1570 RS232 HEX Protocol

DATE: May 19, 2000 Service Instruction No. 1443E (Supersedes Service Instruction No. 1443D) Engineering Aspects are FAA Approved

Vehicle Technical Specifications

SITRANS F flowmeters. SITRANS F O delta p - Primary differential pressure devices. Orifice plate with annular chambers. 4/358 Siemens FI

7. Are you upgrading a complete engine from a TCM/ Bendix to a Slick system? If yes, purchase a complete Slick Ignition Upgrade Kit.

ELITE 2-BURNER PROPANE BARBECUE Assembly Manual

SELECT 3-BURNER PROPANE BARBECUE Assembly Manual

Heavy Duty Actuators CONTROLS. Pneumatic Actuators for Quarter-Turn Valves and Dampers Torques to 1,600,000 in. lbs. Double Acting and Spring Return

Transmission in Limp Home Mode (S- B-27.00/102b, December 16, 2008)

THD. Series. Heavy Duty Actuators. Pneumatic Actuators for Quarter-Turn Valves and Dampers CONTROLS. Torques to 1,600,000 In-lbs

Order No. of the options EMC filter Class A

Audit Attestation for. MICROSEC Micro Software Engineering & Consulting Private Limited Company by Shares

Tabela binarnih kodova

APPENDIX A Instruction Set. Op Code. T states Flags Main Effects. Instructions

First Data DCC Test Card Set. Version 2.00

Memory Analysis RECon2010. Looking In The Eye Of The Bits By Assaf Nativ

SITRANS F flowmeters. SITRANS F O delta p - Primary differential pressure devices Metering pipe with orifice plate and annular chambers 4/369

SERVICE INSTRUCTION. 652 Oliver Street Williamsport, PA U.S.A. Tel Fax

MOONEY INTERNATIONAL CORPORATION The Symbol of Performancet MOONEY SPECIAL LETTER Date:

SELECT 4-BURNER PROPANE BARBECUE Assembly Manual

PRIME 3-BURNER PROPANE BARBECUE Assembly Manual

U36D SERIES Engineering Bulletin Mar 07

SERVICE INSTRUCTION. All Certified Lycoming direct drive engines. TIME OF COMPLIANCE: At owner s discretion.

There are many pre-designs of Vulkan launcher.

VACUUM PRESSURE PUMPS INSTALLATION CAUTIONS AND INFORMATION READ AND FOLLOW CAREFULLY!

Overhaul and repair procedures for the following Standard Cast Cylinder Stud Assemblies and Cylinder Valve Assemblies:

Rotel RSX-1067 RS232 HEX Protocol

Rotel RSX-1065 RS232 HEX Protocol

Rotel RSX-1055 RS232 HEX Protocol

Summary of Specifications

There are many pre-designs of Vulkan launcher.

CLOGGING INDICATORS SUMMING-UP DESCRIPTION

Original BMW Accessories. Installation Instructions.

PRIME 3-BURNER PROPANE BARBECUE Assembly Manual

LYCOMING CYLINDER PRICING

TM ETRS-TM35FIN-ETRS89 WTG

Vehicle Technical Specification Vehicle: Dodge Viper Competition Coupe 8.3LHybrid Class: GT

Audit Attestation for SwissSign AG. Your ref.: Your message from: Our ref.: Date: TUV TRUST IT/wcl

CAT. No. KS-570E. SCS Single Action Push Type. SCD Double Action Type. super. cylinder FUJIKURA RUBBER LTD.

Type 520C 85 C Long Life, Inverter Grade, Aluminum High Ripple, Long Life Screw Terminal Type

CERTIFICATE OF COMPLIANCE

Air Cylinders. Fine Quality. Precision Engineered. Advanced Design. Excellent Prices S T C. Tel:

Type 550C 105 C High Ripple, Inverter Grade, Aluminum Ultra-Ripple, Long Life Screw Terminal Type

Field Variable Area Flowmeters BFP Global Purgemaster

P-920, Revision 32 Page 2 of 13

CERTIFICATE OF COMPLIANCE

5N Data Identifier AIAG. 5Nxx Data Identifiers; Their Formats and Descriptions

K.L.N. COLLEGE OF ENGINEERING DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING Course Outcomes, PO & PSO Mapping Regulation 2013

Original BMW Accessories. Installation Instructions.

City University of New York Faculty Survey of Student Experience (FSSE), Spring 2010

S: With magnet. Bore x stroke (basic type) Cushion P: pneumatic adjustable

Flow Measurement SITRANS F O delta p - Primary differential pressure devices

10/29/2013. Chapter 9. Mechanisms with Lower Pairs. Dr. Mohammad Abuhiba, PE

The Product Range. Technical Data

MICROMASTER 440. Dimension drawings. MICROMASTER 440 inverter

ALC40 Series 105 C. RoHS. Compliant

ALC10 Series 85 C. RoHS. Compliant

CERTIFICATE OF COMPLIANCE

MANDATORY SERVICE BULLETIN

DRAFT VTS. Approved for Racing

SPARE CONNECTORS 2008

RAISEBORING DRILL PIPES

Protection Equipment. 5/2 Introduction

STC Air Cylinders. Fine Quality. Precision Engineered. Advanced Design. Excellent Prices. Air Cylinders

Quicher (NJ-23 / NJ-45 series) (Precision Screw Feeder)

INSTRUMENT PANEL CLUSTERS

GH General Horizontal, Close Coupled and Frame Mounted Pumps

Fixed Displacement Tokimec SQP Vane Pump

9 Secrets to Cut Fleet Costs

Transportation GRADES. Saving the Planet with BIODIESEL. ACROSS

DRAFT VTS. Approved for Racing

General. Principles. 3-Trapped Key Switches. 11-Cat. No. Index. Logic. Power. Safety Switches Trapped Key Switches Overview

part of the EVOX RIFA GROUP

European Aviation Safety Agency

file:///c:/users/zbook/appdata/local/diagnostics/ / /resultre...

~... se_rv_ic_e M_A_NU_AL_2_44_4._z1,~

DDE 5, DDE 6, DDE 6.2 and DDE 6.3

TRUTH AND LIES: CONSUMER PERCEPTION VS. DATA

GENERAL CHEMISTRY. Sub-disciplines of Chemistry. Course Organization. Course Organization: People. What You Need for Lecture

General Applicability: KIA Sorento. Issues Current Kit does not allow for CAN DATA remote access

SUCCESS INDICATORS FOR THE PLAN MMBTU ANALYSIS

BRAZED PHE. Performance - Economy - Reliability - Compact

USE THE FIND FUNCTION TO FIND THE PART NUMBER ( THEY ARE NOT LISTED IN ORDER).

Meeting Room Head Table/Dimensions/Capacities (Subject to Fire Marshal Approval) Seating Capacities

AUTUMN 2013 TIME SCHEDULE

"#$%#$ &! ' ( )% *+! )%,-$#./! #0! 1#$. "#$%#$ *$%$ &! ( 2$/# 3$#! 4%. "#$%#$,5!#6! 70$ *#0! 80 */$6! 90!/ *6+.#0! *#0% ".::6,5!#6!

Drive, Fuse & Circuit Breaker Ratings

SIUC Department of Aviation Technologies Fall Semester 2016

DATE: February 13, 2019 Service Instruction No. 1037V (Supersedes Service Instruction No. 1037U) Engineering Aspects are FAA Approved

MAC VALVES, INC. Rev. T

12185 Presilla Road Camarillo, California phone: (805) fax: (805)

MICROMASTER 440 Inverter

Table of Contents. Basic Information (Cores)

AQUAKITS. life made easy. smart shower solutions

Invoice # /22/ :13 am. AUTOMOTIVE IMPORTS 1207 S PLATTE RIVER DR DENVER, CO Home:(720)

AERO ACCESSORIES, Inc.

IEC CONTACTORS. Contacts Model List Model List AC3 UL 115 V 230 V 200 V 230 V 460 V 575 V NO NC Number Price Number Price 3RT101

Transcription:

CSci 127: Introduction to Computer Science hunter.cuny.edu/csci CSci 127 (Hunter) Lecture 3 13 September 2017 1 / 34

Announcements Welcome back to Assembly Hall, and thank you for your patience in our trek last lecture. CSci 127 (Hunter) Lecture 3 13 September 2017 2 / 34

Announcements Welcome back to Assembly Hall, and thank you for your patience in our trek last lecture. A big thank you to the undergraduate teaching assistants in getting everyone (& chairs) there! CSci 127 (Hunter) Lecture 3 13 September 2017 2 / 34

Announcements Welcome back to Assembly Hall, and thank you for your patience in our trek last lecture. A big thank you to the undergraduate teaching assistants in getting everyone (& chairs) there! The undergraduate teaching assistants (UTAs) will be in 1001E North, assisting with recitation sessions and holding tutoring hours. CSci 127 (Hunter) Lecture 3 13 September 2017 2 / 34

Announcements Welcome back to Assembly Hall, and thank you for your patience in our trek last lecture. A big thank you to the undergraduate teaching assistants in getting everyone (& chairs) there! The undergraduate teaching assistants (UTAs) will be in 1001E North, assisting with recitation sessions and holding tutoring hours. Holidays next week: CUNY Follows Thursday class schedule on Tuesday, 19 September. No classes on Wednesday Friday, 20-22 September. Lecture resumes in two weeks. CSci 127 (Hunter) Lecture 3 13 September 2017 2 / 34

Announcements Welcome back to Assembly Hall, and thank you for your patience in our trek last lecture. A big thank you to the undergraduate teaching assistants in getting everyone (& chairs) there! The undergraduate teaching assistants (UTAs) will be in 1001E North, assisting with recitation sessions and holding tutoring hours. Holidays next week: CUNY Follows Thursday class schedule on Tuesday, 19 September. No classes on Wednesday Friday, 20-22 September. Lecture resumes in two weeks. Starting this week, we will end each lecture with a survey of computing research and the tech industry in NYC. CSci 127 (Hunter) Lecture 3 13 September 2017 2 / 34

Frequently Asked Questions From lecture slips & recitation sections. CSci 127 (Hunter) Lecture 3 13 September 2017 3 / 34

Frequently Asked Questions From lecture slips & recitation sections. I didn t turn in a lecture slip last week. Did I miss it? CSci 127 (Hunter) Lecture 3 13 September 2017 3 / 34

Frequently Asked Questions From lecture slips & recitation sections. I didn t turn in a lecture slip last week. Did I miss it? No, due to the chaos of changing lecture halls, there were no lecture slips. Lecture slips return today. CSci 127 (Hunter) Lecture 3 13 September 2017 3 / 34

Frequently Asked Questions From lecture slips & recitation sections. I didn t turn in a lecture slip last week. Did I miss it? No, due to the chaos of changing lecture halls, there were no lecture slips. Lecture slips return today. Can I get a copy of the lecture slides? CSci 127 (Hunter) Lecture 3 13 September 2017 3 / 34

Frequently Asked Questions From lecture slips & recitation sections. I didn t turn in a lecture slip last week. Did I miss it? No, due to the chaos of changing lecture halls, there were no lecture slips. Lecture slips return today. Can I get a copy of the lecture slides? Yes, the slides are posted on the class website. CSci 127 (Hunter) Lecture 3 13 September 2017 3 / 34

Frequently Asked Questions From lecture slips & recitation sections. I didn t turn in a lecture slip last week. Did I miss it? No, due to the chaos of changing lecture halls, there were no lecture slips. Lecture slips return today. Can I get a copy of the lecture slides? Yes, the slides are posted on the class website. Where do I find the programs from lecture? CSci 127 (Hunter) Lecture 3 13 September 2017 3 / 34

Frequently Asked Questions From lecture slips & recitation sections. I didn t turn in a lecture slip last week. Did I miss it? No, due to the chaos of changing lecture halls, there were no lecture slips. Lecture slips return today. Can I get a copy of the lecture slides? Yes, the slides are posted on the class website. Where do I find the programs from lecture? These are also on the class website. CSci 127 (Hunter) Lecture 3 13 September 2017 3 / 34

Frequently Asked Questions From lecture slips & recitation sections. I didn t turn in a lecture slip last week. Did I miss it? No, due to the chaos of changing lecture halls, there were no lecture slips. Lecture slips return today. Can I get a copy of the lecture slides? Yes, the slides are posted on the class website. Where do I find the programs from lecture? These are also on the class website. I m sure I did Problem 9 correctly, but Gradescope disagrees. Why? CSci 127 (Hunter) Lecture 3 13 September 2017 3 / 34

Frequently Asked Questions From lecture slips & recitation sections. I didn t turn in a lecture slip last week. Did I miss it? No, due to the chaos of changing lecture halls, there were no lecture slips. Lecture slips return today. Can I get a copy of the lecture slides? Yes, the slides are posted on the class website. Where do I find the programs from lecture? These are also on the class website. I m sure I did Problem 9 correctly, but Gradescope disagrees. Why? Some of the grading scripts are really finicky about spacing and new lines. Let us know some we can fix, some have to match exactly. CSci 127 (Hunter) Lecture 3 13 September 2017 3 / 34

Frequently Asked Questions From lecture slips & recitation sections. I didn t turn in a lecture slip last week. Did I miss it? No, due to the chaos of changing lecture halls, there were no lecture slips. Lecture slips return today. Can I get a copy of the lecture slides? Yes, the slides are posted on the class website. Where do I find the programs from lecture? These are also on the class website. I m sure I did Problem 9 correctly, but Gradescope disagrees. Why? Some of the grading scripts are really finicky about spacing and new lines. Let us know some we can fix, some have to match exactly. I m confused by the reading what should I be reading? CSci 127 (Hunter) Lecture 3 13 September 2017 3 / 34

Frequently Asked Questions From lecture slips & recitation sections. I didn t turn in a lecture slip last week. Did I miss it? No, due to the chaos of changing lecture halls, there were no lecture slips. Lecture slips return today. Can I get a copy of the lecture slides? Yes, the slides are posted on the class website. Where do I find the programs from lecture? These are also on the class website. I m sure I did Problem 9 correctly, but Gradescope disagrees. Why? Some of the grading scripts are really finicky about spacing and new lines. Let us know some we can fix, some have to match exactly. I m confused by the reading what should I be reading? For this week: Introductory chapters (1-4) and 8.10 on images. CSci 127 (Hunter) Lecture 3 13 September 2017 3 / 34

Frequently Asked Questions From lecture slips & recitation sections. I didn t turn in a lecture slip last week. Did I miss it? No, due to the chaos of changing lecture halls, there were no lecture slips. Lecture slips return today. Can I get a copy of the lecture slides? Yes, the slides are posted on the class website. Where do I find the programs from lecture? These are also on the class website. I m sure I did Problem 9 correctly, but Gradescope disagrees. Why? Some of the grading scripts are really finicky about spacing and new lines. Let us know some we can fix, some have to match exactly. I m confused by the reading what should I be reading? For this week: Introductory chapters (1-4) and 8.10 on images. What s the best way to study for the final? What should I read? CSci 127 (Hunter) Lecture 3 13 September 2017 3 / 34

Frequently Asked Questions From lecture slips & recitation sections. I didn t turn in a lecture slip last week. Did I miss it? No, due to the chaos of changing lecture halls, there were no lecture slips. Lecture slips return today. Can I get a copy of the lecture slides? Yes, the slides are posted on the class website. Where do I find the programs from lecture? These are also on the class website. I m sure I did Problem 9 correctly, but Gradescope disagrees. Why? Some of the grading scripts are really finicky about spacing and new lines. Let us know some we can fix, some have to match exactly. I m confused by the reading what should I be reading? For this week: Introductory chapters (1-4) and 8.10 on images. What s the best way to study for the final? What should I read? Do all the programming assignments & quizzes. Practice final exams will be available mid-november. CSci 127 (Hunter) Lecture 3 13 September 2017 3 / 34

Today s Topics Indexing and Slicing Lists Colors Hexadecimal Notation 2D Arrays & Image Files CSci 127 (Hunter) Lecture 3 13 September 2017 4 / 34

Last Time: User Input Covered in detail in Lab 2: (Demo with pythontutor) CSci 127 (Hunter) Lecture 3 13 September 2017 5 / 34

Side Note: + for numbers and strings x = 3 + 5 stores the number 8 in memory location x. CSci 127 (Hunter) Lecture 3 13 September 2017 6 / 34

Side Note: + for numbers and strings x = 3 + 5 stores the number 8 in memory location x. x = x + 1 increases x by 1. CSci 127 (Hunter) Lecture 3 13 September 2017 6 / 34

Side Note: + for numbers and strings x = 3 + 5 stores the number 8 in memory location x. x = x + 1 increases x by 1. s = "hi" + "Mom" stores himom in memory locations s. CSci 127 (Hunter) Lecture 3 13 September 2017 6 / 34

Side Note: + for numbers and strings x = 3 + 5 stores the number 8 in memory location x. x = x + 1 increases x by 1. s = "hi" + "Mom" stores himom in memory locations s. s = s + "A" adds the letter A to the end of the strings s. CSci 127 (Hunter) Lecture 3 13 September 2017 6 / 34

In Pairs or Triples... Let s start (mostly) with review review: CSci 127 (Hunter) Lecture 3 13 September 2017 7 / 34

Python Tutor (Demo with pythontutor) CSci 127 (Hunter) Lecture 3 13 September 2017 8 / 34

Review: for-loop for i in list: statement1 statement2 statement3 How to Think Like CS, 4.5 CSci 127 (Hunter) Lecture 3 13 September 2017 9 / 34

Review: for-loop for i in list: statement1 statement2 statement3 where list is a list of items: stated explicitly (e.g. [1,2,3]) or generated by a function, e.g. range(). How to Think Like CS, 4.5 CSci 127 (Hunter) Lecture 3 13 September 2017 9 / 34

range() What if you wanted to count by twos, or some other number: CSci 127 (Hunter) Lecture 3 13 September 2017 10 / 34

range() What if you wanted to count by twos, or some other number: range(start, stop, step) CSci 127 (Hunter) Lecture 3 13 September 2017 10 / 34

range() What if you wanted to count by twos, or some other number: range(start, stop, step) Produces a list: [start,start+step,start+2*step...,last] (where last is the largest start+k*step less than stop) CSci 127 (Hunter) Lecture 3 13 September 2017 10 / 34

range() What if you wanted to count by twos, or some other number: range(start, stop, step) Produces a list: [start,start+step,start+2*step...,last] (where last is the largest start+k*step less than stop) For example, if you want the the list [5,10,...,50] you would write: CSci 127 (Hunter) Lecture 3 13 September 2017 10 / 34

range() What if you wanted to count by twos, or some other number: range(start, stop, step) Produces a list: [start,start+step,start+2*step...,last] (where last is the largest start+k*step less than stop) For example, if you want the the list [5,10,...,50] you would write: range(5,51,5) CSci 127 (Hunter) Lecture 3 13 September 2017 10 / 34

Slices Similar to range(), you can take portions or slices of lists and strings: CSci 127 (Hunter) Lecture 3 13 September 2017 11 / 34

Slices Similar to range(), you can take portions or slices of lists and strings: s[start:stop] gives [start,start+1,start+2...,stop-1]. CSci 127 (Hunter) Lecture 3 13 September 2017 11 / 34

Slices Similar to range(), you can take portions or slices of lists and strings: s[start:stop] gives [start,start+1,start+2...,stop-1]. Also works for lists: CSci 127 (Hunter) Lecture 3 13 September 2017 11 / 34

Slices Similar to range(), you can take portions or slices of lists and strings: s[start:stop] gives [start,start+1,start+2...,stop-1]. Also works for lists: names[1:3] CSci 127 (Hunter) Lecture 3 13 September 2017 11 / 34

Slices Similar to range(), you can take portions or slices of lists and strings: s[start:stop] gives [start,start+1,start+2...,stop-1]. Also works for lists: names[1:3] gives ["Anna", "Alice"] CSci 127 (Hunter) Lecture 3 13 September 2017 11 / 34

Slices Similar to range(), you can take portions or slices of lists and strings: s[start:stop] gives [start,start+1,start+2...,stop-1]. Also works for lists: names[1:3] gives ["Anna", "Alice"] Python also lets you count backwards : last element has index: -1. CSci 127 (Hunter) Lecture 3 13 September 2017 11 / 34

Colors Can specify by name. CSci 127 (Hunter) Lecture 3 13 September 2017 12 / 34

Colors Can specify by name. Can specify by numbers: CSci 127 (Hunter) Lecture 3 13 September 2017 12 / 34

Colors Can specify by name. Can specify by numbers: Amount of Red, Green, and Blue (RGB). CSci 127 (Hunter) Lecture 3 13 September 2017 12 / 34

Colors Can specify by name. Can specify by numbers: Amount of Red, Green, and Blue (RGB). Adding light, not paint: CSci 127 (Hunter) Lecture 3 13 September 2017 12 / 34

Colors Can specify by name. Can specify by numbers: Amount of Red, Green, and Blue (RGB). Adding light, not paint: Black: 0% red, 0% green, 0% blue CSci 127 (Hunter) Lecture 3 13 September 2017 12 / 34

Colors Can specify by name. Can specify by numbers: Amount of Red, Green, and Blue (RGB). Adding light, not paint: Black: 0% red, 0% green, 0% blue White: 100% red, 100% green, 100% blue CSci 127 (Hunter) Lecture 3 13 September 2017 12 / 34

Colors Can specify by numbers (RGB): CSci 127 (Hunter) Lecture 3 13 September 2017 13 / 34

Colors Can specify by numbers (RGB): Fractions of each: CSci 127 (Hunter) Lecture 3 13 September 2017 13 / 34

Colors Can specify by numbers (RGB): Fractions of each: e.g. (1.0, 0, 0) is 100% red, no green, and no blue. CSci 127 (Hunter) Lecture 3 13 September 2017 13 / 34

Colors Can specify by numbers (RGB): Fractions of each: e.g. (1.0, 0, 0) is 100% red, no green, and no blue. 8-bit colors: numbers from 0 to 255: CSci 127 (Hunter) Lecture 3 13 September 2017 13 / 34

Colors Can specify by numbers (RGB): Fractions of each: e.g. (1.0, 0, 0) is 100% red, no green, and no blue. 8-bit colors: numbers from 0 to 255: e.g. (0, 255, 0) is no red, 100% green, and no blue. CSci 127 (Hunter) Lecture 3 13 September 2017 13 / 34

Colors Can specify by numbers (RGB): Fractions of each: e.g. (1.0, 0, 0) is 100% red, no green, and no blue. 8-bit colors: numbers from 0 to 255: e.g. (0, 255, 0) is no red, 100% green, and no blue. Hexcodes (base-16 numbers)... CSci 127 (Hunter) Lecture 3 13 September 2017 13 / 34

Decimal & Hexadecimal Numbers Counting with 10 digits: CSci 127 (Hunter) Lecture 3 13 September 2017 14 / 34

Decimal CSci 127 (Hunter) Lecture 3 13 September 2017 15 / 34

Decimal 00 01 02 03 04 05 06 07 08 09 CSci 127 (Hunter) Lecture 3 13 September 2017 15 / 34

Decimal 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 CSci 127 (Hunter) Lecture 3 13 September 2017 15 / 34

Decimal 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 CSci 127 (Hunter) Lecture 3 13 September 2017 15 / 34

Decimal 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 CSci 127 (Hunter) Lecture 3 13 September 2017 15 / 34

Decimal 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 CSci 127 (Hunter) Lecture 3 13 September 2017 15 / 34

Decimal 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 CSci 127 (Hunter) Lecture 3 13 September 2017 15 / 34

Decimal 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 CSci 127 (Hunter) Lecture 3 13 September 2017 15 / 34

Decimal 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 CSci 127 (Hunter) Lecture 3 13 September 2017 15 / 34

Decimal 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 CSci 127 (Hunter) Lecture 3 13 September 2017 15 / 34

Decimal 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 CSci 127 (Hunter) Lecture 3 13 September 2017 15 / 34

Decimal & Hexadecimal Numbers Counting with 16 digits: CSci 127 (Hunter) Lecture 3 13 September 2017 16 / 34

Hexadecimal 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F CSci 127 (Hunter) Lecture 3 13 September 2017 17 / 34

Hexadecimal 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F CSci 127 (Hunter) Lecture 3 13 September 2017 17 / 34

Hexadecimal 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F CSci 127 (Hunter) Lecture 3 13 September 2017 17 / 34

Hexadecimal 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F CSci 127 (Hunter) Lecture 3 13 September 2017 17 / 34

Hexadecimal 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F CSci 127 (Hunter) Lecture 3 13 September 2017 17 / 34

Hexadecimal 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F CSci 127 (Hunter) Lecture 3 13 September 2017 17 / 34

Hexadecimal 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F CSci 127 (Hunter) Lecture 3 13 September 2017 17 / 34

Hexadecimal 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F CSci 127 (Hunter) Lecture 3 13 September 2017 17 / 34

Hexadecimal 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F CSci 127 (Hunter) Lecture 3 13 September 2017 17 / 34

Hexadecimal 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F CSci 127 (Hunter) Lecture 3 13 September 2017 17 / 34

Hexadecimal 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF CSci 127 (Hunter) Lecture 3 13 September 2017 17 / 34

Hexadecimal 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF CSci 127 (Hunter) Lecture 3 13 September 2017 17 / 34

Hexadecimal 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF CSci 127 (Hunter) Lecture 3 13 September 2017 17 / 34

Hexadecimal 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF CSci 127 (Hunter) Lecture 3 13 September 2017 17 / 34

Hexadecimal 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF CSci 127 (Hunter) Lecture 3 13 September 2017 17 / 34

Hexadecimal 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF CSci 127 (Hunter) Lecture 3 13 September 2017 17 / 34

Side Note: Listing the numbers Used Python: base = 10 digits = "0123456789ABCDEF" for i in digits[:base]: for j in digits[:base]: x = str(i) + str(j) print(x, end=" ") print() CSci 127 (Hunter) Lecture 3 13 September 2017 18 / 34

Colors Can specify by numbers (RGB): Fractions of each: e.g. (1.0, 0, 0) is 100% red, no green, and no blue. 8-bit colors: numbers from 0 to 255: e.g. (0, 255, 0) is no red, 100% green, and no blue. Hexcodes (base-16 numbers): CSci 127 (Hunter) Lecture 3 13 September 2017 19 / 34

Colors Can specify by numbers (RGB): Fractions of each: e.g. (1.0, 0, 0) is 100% red, no green, and no blue. 8-bit colors: numbers from 0 to 255: e.g. (0, 255, 0) is no red, 100% green, and no blue. Hexcodes (base-16 numbers): e.g. #0000FF is no red, no green, and 100% blue. CSci 127 (Hunter) Lecture 3 13 September 2017 19 / 34

In Pairs or Triples... Some review and some novel challenges: CSci 127 (Hunter) Lecture 3 13 September 2017 20 / 34

Trinkets (Demo with trinkets) CSci 127 (Hunter) Lecture 3 13 September 2017 21 / 34

Images CSci 127 (Hunter) Lecture 3 13 September 2017 22 / 34

Images We will use the standard portable network graphics (PNG) file format. CSci 127 (Hunter) Lecture 3 13 September 2017 22 / 34

Images We will use the standard portable network graphics (PNG) file format. Saves every picture element (or pixel ) CSci 127 (Hunter) Lecture 3 13 September 2017 22 / 34

Images We will use the standard portable network graphics (PNG) file format. Saves every picture element (or pixel ) often called a lossless format. CSci 127 (Hunter) Lecture 3 13 September 2017 22 / 34

Images We will use the standard portable network graphics (PNG) file format. Saves every picture element (or pixel ) often called a lossless format. Keeps track of the amount of red, blue, and green of each pixel. CSci 127 (Hunter) Lecture 3 13 September 2017 22 / 34

Images CSci 127 (Hunter) Lecture 3 13 September 2017 23 / 34

Images CSci 127 (Hunter) Lecture 3 13 September 2017 24 / 34

Images CSci 127 (Hunter) Lecture 3 13 September 2017 24 / 34

Images CSci 127 (Hunter) Lecture 3 13 September 2017 24 / 34

Images CSci 127 (Hunter) Lecture 3 13 September 2017 24 / 34

Useful Packages We will use 2 useful packages for images: CSci 127 (Hunter) Lecture 3 13 September 2017 25 / 34

Useful Packages We will use 2 useful packages for images: numpy: numerical analysis package CSci 127 (Hunter) Lecture 3 13 September 2017 25 / 34

Useful Packages We will use 2 useful packages for images: numpy: numerical analysis package pyplot: part of matplotlib for making graphs and plots CSci 127 (Hunter) Lecture 3 13 September 2017 25 / 34

Useful Packages We will use 2 useful packages for images: numpy: numerical analysis package pyplot: part of matplotlib for making graphs and plots See lab notes for installing on your home machine. CSci 127 (Hunter) Lecture 3 13 September 2017 25 / 34

Images with pyplot and numpy CSci 127 (Hunter) Lecture 3 13 September 2017 26 / 34

More on numpy arrays numpy tutorial CSci 127 (Hunter) Lecture 3 13 September 2017 27 / 34

In Pairs or Triples... Some review and some novel challenges: CSci 127 (Hunter) Lecture 3 13 September 2017 28 / 34

Python Tutor (Demo with idle3) CSci 127 (Hunter) Lecture 3 13 September 2017 29 / 34

Recap Indexing and Slicing Lists Colors Hexadecimal Notation 2D Arrays & Image Files CSci 127 (Hunter) Lecture 3 13 September 2017 30 / 34

CS Surveys Survey of research at Hunter & tech industry in NYC... CSci 127 (Hunter) Lecture 3 13 September 2017 31 / 34

CS Survey: Prof. St. John, computational biology CSci 127 (Hunter) Lecture 3 13 September 2017 32 / 34

CS Survey: Prof. St. John, computational biology (American Museum of Natural History) CSci 127 (Hunter) Lecture 3 13 September 2017 33 / 34

CS Survey: Prof. St. John, computational biology (American Museum of Natural History) CSci 127 (Hunter) Lecture 3 13 September 2017 33 / 34

CS Survey: Prof. St. John, computational biology (American Museum of Natural History) Finding optimal evolutionary histories for biological data. Computationally hard questions. Collaborate with biologists & anthropologists at AMNH, & team of undergraduate researchers. CSci 127 (Hunter) Lecture 3 13 September 2017 33 / 34

Lecture Slips & Writing Boards Turn in lecture slips & writing boards as you leave... CSci 127 (Hunter) Lecture 3 13 September 2017 34 / 34