compsci 101 introduction to computer science january 22, 2015 prof. rodger compsci101 spring151

23
CompSci 101 Introduction to Computer Science January 22, 2015 Prof. Rodger compsci101 spring15 1

Upload: sage-shield

Post on 11-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

CompSci 101Introduction to Computer Science

January 22, 2015

Prof. Rodger

compsci101 spring15 1

Announcements• Reading, RQ 05 for next time• Assignment 2 due Tues• APT 1 is due today, APT 2 out

compsci101 spring15 2

REMINDERDO NOT SIT IN THE LAST

TWO ROWS!

Come forward and sit beside someone you haven’t met

compsci101 spring15 3

How many ways can I run Python in this course?

• Eclipse– Complete program– Console– APT

• Online textbook– Beware Python 3 (‘/’ (2.7) vs ‘//’ (3) )

• Python Tutor

compsci101 spring15 4

How to get Help in this class• Piazza• Consulting hours (Sunday-Thursday nights)• Office hours (Prof, Tas)• What happens if my laptop breaks and I can’t

use my eclipse? Do I stop programming?– Clusters, Python Tutor, websubmit, borrow

• What happens if you send Prof. Rodger an email?

• 35 support people vs. 1 person, may take awhile to answer

compsci101 spring15 5

Submitting an APT or Assignment

• Use Ambient – submit– Submit History – files submitted should be

listed!– Alternative – use web submit– Tuesday midnight means Tuesday 11:59pm + 1

minute– If you can’t submit on your computer, copy

your file to another computer (Link?) and submit with websubmit on that computer

compsci101 spring15 6

Why is this person so important to this course?

• Have you donated yet?

compsci101 spring15 7

Top 10 list for surving in CompSci 101

10. Ask questions

9. Eat lots of pizza

8. Learn how to spell Rodger

7. Read the book

6. Do the reading quizzes

compsci101 spring15 8

Top 10 list (cont)

5. Check Piazza every day

4. Visit your prof in her office

3. Learn how to debug your programs

2. Seek help (one hour rule!)

1. Start programming assignments early

compsci101 spring15 9

Algorithm

• Describe in words how to solve a problem• Like a recipe, must be detailed and precice

compsci101 spring15 10

Whole Genome Shotgun with wordsbit.ly/101S15-0122-01

• Creation algorithm– Take a phrase– Replicate it four times– Chop into "chunks"

• 15-22 characters

• Figure out the original phrase

• Describe the algorithm to recreate original phrase?

olve problems.ratively, create, compsci101 we get t01 we get to work collavely, create, and s. In compsci1y, create, and se get to work collabo

compsci101 spring15 11

Review Functions www.bit.ly/101S15-0122-02

compsci101 spring15 12

Use Python Tutor

• Debug/trace your code• Doesn’t work with input files

compsci101 spring15 13

Assignment 2

• How to start?• Where does import go?• Student work?

compsci101 spring15 14

Solve an APT - Pancakesbit.ly/101S15-0122-03

compsci101 spring15 15

Computer Science Alum

• Biology and CS• Undergraduate Research - JFLAP• Epic• Now in Med School at Vanderbilt

compsci101 spring15 16

More Computer Science Duke Alums

compsci101 spring15 17

More on Strings• Strings are indexed starting at 0• Example: ‘word’

• Use [num] – to refer to a particular character in word

• Use [x:y] to refer to a slice of the string starting at position x and up to but not including position y. Can leave out x or y.

w o r d0 1 2 3

compsci101 spring15 18

Examplesphrase = "Duke Blue Devils"print phrase[0]print phrase[-3]print phrase[1:3]print phrase[5:10] + phrase[:4]print (phrase[phrase.find('ev'):]).upper()

String funCrazy import compsci101 spring15 19

Loop over all characters in a String

compsci101 spring15 20

Loop over string• Online form: www.bit.ly/101S15-0122-04

compsci101 spring15 21

Loop over all words in a list

compsci101 spring15 22

Loop over words• Online form: www.bit.ly/101S15-0122-05

compsci101 spring15 23