comp 171: principles of computer science i john barr

12
COMP 171: Principles of Computer Science I John Barr

Upload: clementine-clarke

Post on 30-Dec-2015

225 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: COMP 171: Principles of Computer Science I John Barr

COMP 171: Principles of Computer Science IJohn Barr

Page 2: COMP 171: Principles of Computer Science I John Barr

What is Computer Science?

Problem Solving

Understanding the problem/challenge

Breaking down the problem into solvable pieces

Using the tools you have to solve the problem

Page 3: COMP 171: Principles of Computer Science I John Barr

What is Computer Science?

Solution: An Algorithm

Step-by-step procedure to solve the problem from beginning (start state) to end (end state)

Page 4: COMP 171: Principles of Computer Science I John Barr

What is Computer Science?

For CS, algorithms need to be expressed in a form the computer can understand.

Programming LanguageYour way to tell the computer your algorithm

(your solution) Computer will only do what you tell it to do

Page 5: COMP 171: Principles of Computer Science I John Barr

Our Programming Language: Python - Version 3.x

Powerful, but easy to use

Interpreted Language (not compiled)Simple syntaxRuns immediately (but slightly slower)

Allows for Rapid Prototyping

Page 6: COMP 171: Principles of Computer Science I John Barr

Our Course

Learn to solve problems with computers by creating algorithms, and translating those algorithms in Python code.

Give the computer instructions to solve instances of the problem for us.

Page 7: COMP 171: Principles of Computer Science I John Barr

Typical Weekly Schedule

M TU W TH F SA SU

New Topic New Lab

Deeper into new topic

Extra challenge

Working on lab Reading / Working on Homework

Homework Due

Lab due

Quiz

Our Course

Page 8: COMP 171: Principles of Computer Science I John Barr

Sakai for Class Information

Syllabus Textbook Assignments TA hours Class web site Other resources

Start Python download now… Python 3.x

Page 9: COMP 171: Principles of Computer Science I John Barr

Our Book / Homework System

Interactive Python, by Runestone InteractiveGoogle “Interactive Python”To create an account, scroll to the very bottom of this

page, and click the small blue "register" link.

The course name is:

IC-Comp-17-FA-14 After, submit your username on Sakai

Page 10: COMP 171: Principles of Computer Science I John Barr

Starting with Python - IDLE

The environment we will use to create and run python programs

Very simple

Downloads with python

Page 11: COMP 171: Principles of Computer Science I John Barr

IDLE: Using the shell>>> 2+2

4

>>> print "Hello, World"

Hello, World

Tinkering in the shell is fine, but when you want to maintain / save / share your work, use a module.

Page 12: COMP 171: Principles of Computer Science I John Barr

Creating a module

print “Running Module” def main(): #comment inside module print ("Hello, World”)

main()

• Select “Run > Run Module” (save the file as “HelloWorld”)• A shell will open up with your program loaded

In IDLE:• Select “File -> New Window”

• or “File->New File” on a Mac• This new window is a “module”• Type the following: