33
Carnegie Mellon Worcester Polytechnic Institute CS-1004 — Introduction to Programming for Non-Majors Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An Introduction to Computer Science, 2 nd edition, by John Zelle and copyright notes by Prof. George Heineman of Worcester Polytechnic Institute) Introduction CS-1004, A-Term 2014 1

CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute

CS-1004 — Introduction to Programming for Non-Majors

Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An Introduction to Computer Science, 2nd edition, by John Zelle and copyright notes by Prof. George Heineman of Worcester Polytechnic Institute)

Introduction CS-1004, A-Term 2014 1

Page 2: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Welcome to CS-1004

Introduction … No specific computing background assumed General High school education and basic math Familiarity with Word, Excel, computer games,

keyboard, etc., helpful Need to do computing in your own field!

… to Computer Programming How to instruct a computer to do something

specific for your needs … … in your own field

… for Non-Majors Not CS, IMGD Tech, most RBE, some BCB, etc.

Introduction CS-1004, A-Term 2014 2

Page 3: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

CS-1004 vs. CS-1101/1102

How many … Know how to drive a car?

Use of Word and Excel

Know how to drive a stick shift? Advanced features of Word

Formulas in Excel

Could change a tire if necessary? This course

Could change the oil if necessary? This course

Could break down and rebuild an automatic

transmission? … or design a new one?

CS-1101/1102

Introduction CS-1004, A-Term 2014 3

Page 4: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Introduction CS-1004, A-Term 2014 4

Page 5: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

This Course

Python programming language Specifically, Python 3.4

Doing things! Getting a program to work at all Building up your reflexes! Debugging

Thinking computationally What you could do with your data … … if only you could compute on it!

Preparation for next CS courses for non-majors CS-220X CS-2301

Introduction CS-1004, A-Term 2014 5

Also CS Minor

Page 6: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Courses for CS Minor

CS 1101 CS 1102 CS 1004

CS 220X Non-Major Building SW

Apps with OO

CS 2301 Sys. Prog. For Non-majors

CS 2303 Sys. Prog. Concepts

CS 2102 Object

Oriented Design

CS 2011 Mach. Org. & Assem. Lang.

CS 2223 Algorithms

CS 2022/ MA 2201

Discrete Mathematics

OR

OR

CS 3013 Operating Systems

CS 3516 Computer Networks

CS 3041 Human Comp.

Interaction

OR

CS 3043 Social Impl.

of Info. Processing

CS 3133 Foundations

of Comp. Science

CS 3431 Database Systems I

CS 3733 Software

Engineering

CS 4513 CS 4516

CS 4515

CS 4233

Introduction CS-1004, A-Term 2014 6

Artificial Intelligence

Other courses for CS Majors

Page 7: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Outline for Today

Introduction

Logistics

Discussion: What is Programming?

Our first program

Introduction CS-1004, A-Term 2014 7

Page 8: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Logistics

Lectures:– Monday, Tuesday, Thursday, Friday, 8:00-9:00 AM Lower Fuller Auditorium

Overflow:– Fuller 320 (live streaming) No class on Monday, September 1 (Labor Day)

Quizzes:– Every Thursday from Sept 4 → Oct 16 At start of class time. Approx 20 minutes (except

last quiz) You may start as soon as you arrive! Stay in seat when you are finished Best five out of seven

No make-up quizzes! See Professor if you have to be away

e.g., interviews, projects, etc. Let me know ASAP if you are sick/need to be away

We will figure something out

Introduction CS-1004, A-Term 2014 8

Page 9: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Logistics (continued)

Lab sections Goddard 012:– 8:00 AM, 9:00 AM, 4:00 PM Higgins 230:– 11:00 AM

Attendance Counts!

Must attend your own, registered session Space not guaranteed in later sections if you

oversleep!

Waitlist:– 12 students at time of this writing! Will operate an overflow room — Fuller 320

Seats in Lower Fuller Auditorium First-come, First-served

Introduction CS-1004, A-Term 2014 9

Page 10: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Course Survey

Please complete ASAP Leave at front table

All students should complete this: Both Registered and Waitlisted

Note: use your WPI E-mail ID! Not the nine-digit serial number on your ID

card. Reason:– all of the tools and databases for

administering the course are indexed by E-mail ID

Introduction CS-1004, A-Term 2014 10

Page 11: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Names and Faces

It is in your own interest that I know who you are.

Class pictures

Students who speak up in class usually get more favorable grades than those who don’t

When speaking in class, please identify yourselves

Introduction CS-2011, D-Term 2014 11

Page 12: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute

Questions?

Introduction CS-1004, A-Term 2014 12

Page 13: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Teaching staff

Ph. D. Carnegie-Mellon, 1972-73 Dissertation

“Correctness in Operating Systems”

Faculty at University of Newcastle upon Tyne, UK

Approximately 30 years in industry in USA

WPI since 2006 21 US patents issued 2 seminal

contributions to Computer Science

Introduction

Hugh C. Lauer Adjunct Professor

CS-2011, D-Term 2014 13

Page 14: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

TAs and SAs

Introduction CS-2011, D-Term 2014 14

Zhongfang Zhuang

Alex Chen

Samantha Swartz Jonathan Wu

Page 15: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

MASH leader

Introduction CS-1004, A-Term 2014 15

Tim DeFreitas

Page 16: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Textbook

John Zelle, “Python Programming: an introduction to Computer Science, Second Edition”, Franklin, Beedle, & Associates, 2010

$22.48 from Amazon!

Reading Assignment — §1.1 – 1.5 By tomorrow!

Introduction CS-2011, D-Term 2014 16

Page 17: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Introduction CS-1004, A-Term 2014 17

Page 18: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

What is Python?

Created in 1989 by Guido van Rossum Originally as a scripting language

Since then, has grown to broad user base Many scientific and engineering applications Many 3rd-party packages — more than 45,000

Simple, easy to learn

Extremely rich in concepts and capabilities

Intelligent about numerical calculations

Introduction CS-1004, A-Term 2014 18

Page 19: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Grading

40% quizzes Final quiz is worth 2 times any other quiz

40% Programming assignments Roughly equal in weight (??)

20% Class and Lab participation Helping each other Contributing to discussion groups Asking questions & asking for help It is in your interest that the Professor and TAs

know you by name Please don’t be embarrassed/annoyed if we

ask you often

Introduction CS-2011, D-Term 2014 19

Page 20: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Grading Emphasis

How much you grow during this term!

HOW you solve the programming problem — NOT the resulting program

Introduction CS-1004, A-Term 2014 20

Page 21: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Policies: Programming Assignments

Team work First programming assignment is individual Remaining assignments are 2-person teams

Turnin Assignments due at 6:00 pm on due date Electronic turn-ins using web-based Turnin

(unless otherwise specified)

Late assignments 5% per hour for the first two hours 10% for each additional hour Based on timestamp in Turnin

Introduction CS-2011, D-Term 2014 21

Page 22: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Policies: Programming Assignments (continued)

… Conflict exams, other irreducible conflicts Make PRIOR arrangements with Prof. Lauer Notifying us well ahead of time shows maturity

and makes us like you more (and thus to work harder to help you out of your problem)

Appealing grades Within 7 days of completion of grading Labs: Email to the staff mailing list Quizzes: Talk to Prof. Lauer

Introduction CS-2011, D-Term 2014 22

Page 23: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Getting Help

Class Web Page: http://www.cs.wpi.edu/~cs1004/a14 Complete schedule of lectures, quizzes, and

assignments Copies of lectures, assignments, exams,

solutions Clarifications to assignments

myWPI Repository for copyright materials (lecture

notes)

Lecture Capture Lectures will be recorded using WPI’s Echo

Lecture Capturing system. Can be viewed at

Link to be provided after first lecture!

Introduction CS-2011, D-Term 2014 23

Page 24: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Getting Help

Course mailing list: [email protected] Use as discussion list

Staff mailing list: [email protected] Use this for ALL communication with the teaching

staff Send email to individual instructors or TAs only to

schedule appointments

Office hours (Prof. Lauer): Monday, 1:30 – 3:30 PM Also: see course web-

site Tuesday, 12:00 – 1:00 PM Thursday, 10:00 – 11:00 AM Friday, 1:30 – 2:30 PM

1:1 Appointments You can schedule 1:1 appointments with Professor

or any of the TAs at other times

Introduction CS-2011, D-Term 2014 24

Page 25: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Ground Rule #1

There are no “stupid” questions.

It is a waste of your time and the class’s time to proceed when you don’t understand the basic terms.

If you don’t understand it, someone else probably doesn’t it, either.

Introduction CS-2011, D-Term 2014 25

Page 26: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Ground Rule #2

Help each other!

Even when a project or assignment is specified as individual, ask your friends or classmates about stuff you don’t understand.

It is a waste of your time try to figure out some obscure detail on your own when there are lots of resources around.

When you have the answer, write it in your own words (or own coding style).

Introduction CS-2011, D-Term 2014 26

Page 27: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

WPI Honesty Policy

What is cheating? Sharing code: by copying and pasting,

supplying a file Coaching: helping your friend to write a

program, line by line Copying code from previous course or from

elsewhere on WWW Only allowed to use code we supply

What is NOT cheating? Explaining how to use systems or tools Helping others with abstract design issues Working out a problem together on a

whiteboard, back of napkin, etc. Typing it in yourself

Introduction CS-2011, D-Term 2014 27

Unless otherwise specified!

Page 28: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

WPI Honesty Policy (continued)

It is a violation of the WPI Academic Honesty Policy to submit someone else’s work as your own.

It is not a violation of WPI’s Academic Honesty Policy to ask for help!

Classmates, TAs, friends, mentors, …

Explanations of things you don’t understand

Introduction CS-2011, D-Term 2014 28

Page 29: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Special Rule for this Class

You may discuss problems with anyone Unless otherwise specified!

You may jointly working out solutions on whiteboard, back of envelope, napkin, etc.

You MUST write it down with pen, pencil, etc., and then TYPE IT YOURSELF into a program file

You may not copy and paste from an electronic version.

WHY? Introduction CS-1004, A-Term 2014 29

Page 30: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Cheating Penalty

First offense:– Homework grade reduced by entire value of

homework project I.e., a negative score!

Letter to Dean of Students Office

Subsequent offenses:– Campus Hearing Board

Questions?

Introduction CS-1004, A-Term 2014 30

Page 31: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Note on Quizzes

Open book, open notes

Many students have electronic textbooks Kindle Tablet Laptop

Okay to consult electronic textbook

May NOT connect to network, web, etc.

Introduction CS-2011, D-Term 2014 31

Page 32: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute Worcester Polytechnic Institute

Work practices

1.5 – 2 hours per day

Every day of the week Including weekends

Like learning a (spoken) language!

Introduction CS-1004, A-Term 2014 32

Page 33: CS-1004 — Introduction to Programming for Non-Majorsweb.cs.wpi.edu/.../a14/Protected/LectureNotes-A14/Week0_Introduct… · CS-1004 — Introduction to Programming for Non-Majors

Carnegie Mellon Worcester Polytechnic Institute

Welcome to CS-1004

Let’s get to work!

Introduction CS-1004, A-Term 2014 33