cps6-110901

cps6-110901 - CompSci 6 Introduction to Computer Science...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
CompSci 6 Introduction to Computer Science September 1, 2011 Prof. Rodger compsci 6 fall 2011 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Announcements • Read for next time Chap. 2 • Reading Quiz on Blackboard – Due before class next time • Assignment 1 out – due Sept 5! (not Python) • Labs start today! – Finish installing software for course – Problem solving compsci 6 fall 2011 2
Background image of page 2
Word Cloud from last time How do we build a world cloud? compsci 6 fall 2011 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Focus on Simpler Problems • How many words in a file? – What is a file? – What is a word? – How do we count the words • How many unique words are in a file? – How is this problem different? compsci 6 fall 2011 4
Background image of page 4
Python Code to solve this def countWords(filename): file = open(filename) str = file.read() words = str.split() unique = set(words) print "filename: ", filename print "total # words = ",len(words) print "unique # words = ",len(unique) countWords(‘romeo.txt') filename: romeo.txt total # words = 25788 unique # words = 6394 OUTPUT: Questions?
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 11

cps6-110901 - CompSci 6 Introduction to Computer Science...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online