COMPSCI 101 S1 2015
Principles of Programming
Lecture 1 – Introduction
2
Learning outcomes
At the end of this lecture, students should be able to: understand where to obtain information about CompSci 101 understand which parts of the CompSci 101 assessment contribute to the practical mark understand which parts of the CompSci 101 assessment contribute to the theory mark understand that to pass CompSci 101, both the practical part of the course and the theory part of the course need to be passed understand an algorithm
CompSci 101
3
The CompSci 101 website
This is the address of the CompSci 101 website https://www.cs.auckland.ac.nz/courses/compsci101s1c/
Here you will find all the information about our course set up
Get used to looking at this website for information about lecture slides, lab documents, assignment resources, assessment, people involved in the course and lots more.
CompSci 101
4
People in this course
Email: ann@cs.auckland.ac.nz
Phone: 373-7599 ext 84947
Room: 303S.479
CompSci 101
5
People in this course
Angela Chang (Course Coordinator)
Email: angela@cs.auckland.ac.nz
Phone: 373-7599 ext 86620
Room: 303S.494
Office Hours: Open door policy – Visit any time
Adriana Ferraro
Email: adriana@cs.auckland.ac.nz
Phone: 373-7599 ext 87113
Room: 303S.490
Dr Jing Sun
Email: j.sun@auckland.ac.nz
Phone: 373-7599 ext 82286
Room: 303S.481
CompSci 101
Lecture schedule
On the course information sheet there is a schedule of the lectures for CompSci 101.
6 CompSci 101
Lecture Slides
Lecture slides will be available on the web before each lecture.
7 https://www.cs.auckland.ac.nz/courses/compsci101s1c/lectures
CompSci 101
There is no textbook for CompSci 101
No textbook but we do have an online reference book, Think
Python – How to think like a computer scientist.
Please be aware that we are teaching the CompSci 101 material in a different order to the ordering in this book. This book is a reference book, not a textbook for this course.
8 https://www.cs.auckland.ac.nz/courses/compsci101s1c/resources/
CompSci 101
More about labs
Labs start in the second week
Labs are held in room 279 (Building 303S) which is on the second floor of the Computer Science building.
There are 9 labs and worth 9% of your final mark.
At your lab time you will be given programming problems to solve within the 2 hours for your lab.
9 https://www.cs.auckland.ac.nz/courses/compsci101s1c/labs/
CompSci 101
Before the first lab
Visit the lab on Friday between 11am and 12:30pm.
Before the first lab you need to complete the lab preparation sheet
(I will hand this out).
In order to fill the sheet you need to visit the CompSci 101 lab on
Friday.
10 CompSci 101
Assignments
The assignments are worth 9% of your final mark.
Assignments give you the experience of solving problems on your own. Never share your code.
Solve the problem on your own – discuss the assignment with others but never share code
.
11 https://www.cs.auckland.ac.nz/courses/compsci101s1c/assignments/
CompSci 101
Assignments
There are 4 assignments.
All assignments are due at 4:30pm on the due date.
The assignments are handed in using the Assignment Drop Box:
12 https://adb.auckland.ac.nz/Home/
CompSci 101
Code Runner Exercises
There are 3 Code Runner Exercises and are worth 7% of your final mark.
All exercises are due at 4:30pm on the due date.
Exercises are to be completed using the Code Runner System: https://www.coderunner.auckland.ac.nz/
13 CompSci 101
Plagiarism
Plagiarism: Any work that you take credit for, but which is done by someone else. This is treated very seriously in an academic environment.
https://www.auckland.ac.nz/en/about/teaching-learning/academic-
14 CompSci 101 integrity.html
Academic Integrity
15 https://www.auckland.ac.nz/en/about/teaching-learning/ academic-integrity.html
CompSci 101
Test
The test is worth 15% of your final mark
The test date and time is: Tuesday 5th May 6:30pm - 7:45pm
The test is 75 minutes long plus 5 minutes of reading time. Arrive at 6:20 because your reading time starts at 6:25pm.
More about this closer to the time.
16
Email Angela Chang(angela @cs.auckland.ac.nz) , the CompSci 101 course coordinator, if you are unable to attend the test
CompSci 101
Exam
The exam is worth 60% of your final mark.
https://www.auckland.ac.nz/en/for/current-students/cs-academicinformation/cs-examination-information.html
17 CompSci 101
Passing CompSci 101
Assessment
Labs
PRACTICAL
9%
Code Runner 7%
Assignments 9%
Test
THEORY
15%
Exam 60%
18
To pass the course you MUST pass the PRACTICAL (i.e. get 12.5 / 25) you MUST pass the THEORY (i.e. get 37.5 / 75)
CompSci 101
The CompSci 101 website
Most of the resources you will need (e.g., lecture slides, lab material, assignments, course information) can be found on the CompSci 101 website: https://www.cs.auckland.ac.nz/courses/compsci101s1c/
19 CompSci 101
Cecil
On Cecil you will find: your marks class announcements lecture recordings http://cecil.auckland.ac.nz
20 CompSci 101
Computing resources
There are demonstrators in these labs to help you
21
GCL (room 091) – Ground
Floor Computer Lab
This is a
lab
CompSci 101
Learning outcomes for CompSci 101
22
determine the state of the program both during and after execution, given a code listing that may include functions and parameters, loops, conditionals and sequences, implement a given algorithm using Python, show that a program meets given specifications by writing appropriate tests, provide a useful level of documentation, in the form of program comments, for all programs developed, decompose a simple problem into several smaller tasks, given a brief textual description of the problem, compose functions that perform a specified task into a program that solves a given problem, describe program design and syntax using written language,
CompSci 101
Algorithms
A finite set of steps that specify a sequence of operations to be carried out in order to solve a specific problem.
A better definition:
An algorithm is a well-defined, unambiguous sequence of steps
23 CompSci 101
24
Algorithms – what kind of steps?
HOW TO
GET TO
UNI
An algorithm is a well-defined, unambiguous sequence of steps sequential operations
Walk to the bus stop at the shops up the road
Get on bus number "101"
Pay the bus driver $3.50
Get off at the Symonds St bus stop
Walk 200m to the Computer Science building
CompSci 101
Algorithms – what kind of steps?
HOW TO
WALK TO
THE BUS
STOP
An algorithm is a well-defined, unambiguous sequence of steps
Open the front door conditional operations
IF it is raining THEN take an umbrella
25
Walk down the driveway and turn left
Walk 50m down the street
CompSci 101
Algorithms – what kind of steps?
HOW TO
PAY THE
BUS FARE
An algorithm is a well-defined, unambiguous sequence of steps iterative operations
Open wallet
WHILE you still haven't paid enough give the driver another coin
Take a seat
26 CompSci 101
Basic programming steps
TASK
1 design
2 coding
CODE
27
3 testing
CompSci 101
ALGORITHM
PROGRAM
Programming - Step 2 - write the code
We will use the Python programming language to implement our algorithms
ALGORITHM
2 coding
Python
CODE
28 CompSci 101
Hangman
Enter a letter: d
+---+
| |
0 |
/|\ |
/ \ |
|
=========
+---+
| |
|
|
|
|
=========
Word: l a _ _ b o n e s
Letters Missed: r m k c u d
Letters Guessed: a e s n o l b
Letters Available: fghijpqtvwxyz
Word: _ _ _ _ _ _ _ _ _
Sorry, you have lost in the game of
Hangman...
The word was lazybones
Letters Missed:
Letters Guessed:
Letters Available: abcdefghijklmnopqrstuvwxyz
Enter a letter: a
CompSci 101
TicTacToe
Do you want to be X or O: X
The computer will go first.
What is your next move? (1-9): 6
| |
| | O
| |
-----------
| |
| |
| |
-----------
| |
| |
| |
| |
O | X | O
| |
-----------
| |
O | X | X
| |
-----------
| |
X | O | O
| |
What is your next move? (1-9):
30
5
The game is a tie!
Do you want to play again?
(yes or no): n
CompSci 101
What you need to do this week…
Go to our course website: https://www.cs.auckland.ac.nz/courses/compsci101s1c/resources/
Download and Install Python (Version 3.x): 3.3 or 3.4
https://www.python.org/download/releases/3.3.4/
Download and Install Notepad++
http://notepad-plus-plus.org/
Set up Notepad++ to run Python programs
Add a command:
Macro -> Run Python https://www.cs.auckland.ac.nz/courses/compsci101s1c/resources/SetUpNotePad++.pdf
Download Python reference book: Think Python
https://www.cs.auckland.ac.nz/courses/compsci101s1c/resources/thinkpython.pdf
31 CompSci 101