Beruflich Dokumente
Kultur Dokumente
Learning outcomes
!At the end of this lecture, students should be able to:
! understand where to obtain informa.on about CompSci 101
! understand which parts of the CompSci 101 assessment contribute to the prac.cal mark
WELCOME TO ! understand which parts of the CompSci 101 assessment contribute to the theory mark
! understand that to pass CompSci 101, both the prac.cal part of the course and the
COMPSCI 1 1 theory part of the course need to be passed
CompSci 101 - Principles of Programming 9 CompSci 101 - Principles of Programming 10
Think Python How to think like a computer scienGst. ! You must abend two 2 hour tutorial lab sessions each week. One will be on Monday or
Tuesday and the other on Thursday or Friday. You will have enrolled in 2 lab .mes. Your
h.ps://www.cs.auckland.ac.nz/courses/compsci101ssc/resources/
Monday/Tuesday lab .me is labelled Lab on Student Services Online, and your Thursday/
! Please be aware that we are teaching the CompSci 101 material in a dierent order to Friday lab is labelled Tut. You should abend the same lab .mes each week.
the ordering in this book. This book is a reference book, not a textbook for this course. ! Labs are held in room 279 (Building 303S) which is on the second oor of the
Computer Science building.
h.ps://www.cs.auckland.ac.nz/courses/compsci101ssc/labs/
CompSci 101 - Principles of Programming 13 CompSci 101 - Principles of Programming 14
h.ps://www.cs.auckland.ac.nz/courses/compsci101ssc/labs/
Assignments Assignments
!The assignments are worth 11% of your nal mark. !There are 5 assignments in total worth 11% of your nal mark.
!Assignments give you the experience of solving problems on your
own. !For three of these ve assignments (7% of your nal mark), you are
!Never share your code. required to write and submit one or more programs.
h.ps://adb.auckland.ac.nz/Home/
h.ps://www.cs.auckland.ac.nz/courses/compsci101ssc/assignments/
CompSci 101 - Principles of Programming 17 CompSci 101 - Principles of Programming 18
to use CodeRunner. Plagiarism: Any work that you take credit for, but
which is done by someone else. This is treated very
seriously in an academic environment.
!The CodeRunner tool is designed to help you prac.se by presen.ng
you with a set of coding and other exercises. Students can work
with on-line exercises using the Moodle learning system.
h.ps://www.coderunner.auckland.ac.nz/moodle/
h.ps://www.cs.auckland.ac.nz/courses/compsci101ssc/assignments/ h.ps://www.academicintegrity.auckland.ac.nz
h.ps://canvas.auckland.ac.nz
CompSci 101 - Principles of Programming 25 CompSci 101 - Principles of Programming 26
! A beber deni.on:
An algorithm is a Walk to the bus stop at the shops up the road
sequenGal
well-dened, operaGons
Get on bus number "101"
unambiguous
sequence of steps
Pay the bus driver $4.50
27
CompSci 101 - Principles of Programming 29 CompSci 101 - Principles of Programming 30
HOW TO Algorithms what kind of steps? HOW TO PAY Algorithms what kind of steps?
WALK TO THE THE BUS
BUS STOP FARE
An algorithm is a well-dened, unambiguous An algorithm is a well-dened, unambiguous
sequence of steps sequence of steps
iteraGve
condiGonal Open the front door operaGons Open wallet
operaGons
[ [
IF it is raining THEN WHILE you s.ll haven't paid enough
take an umbrella give the driver another coin
ALGORITHM
2 coding
2 coding
CODE
3 tes0ng Python
CODE
PROGRAM
CompSci 101 - Principles of Programming 33 CompSci 101 - Principles of Programming 34
Hangman algorithm
********************
- - -
TicTacToe
Computer move
- - -
Enter a letter: d! ********************
- - -
+---+ ! X - O
********************
O X X
| | !
Computer move
Letters Available: fghijpqtvwxyz! - X -
========= ! ********************
! - - -
! X X O
Word: _ _ _ _ _ _ _ _ _ ! ! ********************
O X X
Sorry, you have lost in the game of !
! X enter your next move? (1-9): 1 X O O
Letters Missed: ! Hangman...! ********************
The word was lazybones!
...
Letters Guessed: !
Letters Available: abcdefghijklmnopqrstuvwxyz! The result is a draw.!
Enter a letter: a!
!