COMP 171: Principles of Computer Science I John Barr

Preview:

Citation preview

COMP 171: Principles of Computer Science IJohn 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

What is Computer Science?

Solution: An Algorithm

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

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

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

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.

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

Sakai for Class Information

Syllabus Textbook Assignments TA hours Class web site Other resources

Start Python download now… Python 3.x

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

Starting with Python - IDLE

The environment we will use to create and run python programs

Very simple

Downloads with python

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.

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:

Recommended