Class 1: What this course is about Assignments • Reading: Chapter 1, pp 1-33 • Do in Class 1: – Exercises on pages 13, 14, 22, 28 • To hand in in Class 2: – Exercises on p 33 In a nutshell • This course is about writing computer programs which solve problems – First step: ‘grok’ the problem. (Look up the meaning and origin of ‘grok’.) – Second step: write the program – Third step: make sure the program correctly solves the problem What is an algorithm? • An algorithm is an unambiguous, step-bystep procedure for solving a problem • A recipe is an example of an algorithm • An algorithm provides the design for a computer program What is a computer language? • A computer language is a notation for writing down algorithms • ‘High level’ languages are readable, like natural human languages • Computer languages are precise enough to be executed by (unthinking) machines • All computer languages are fundamentally equivalent in their expressive power What is a program? • A program is a set of instructions written in a computer language • A program implements an algorithm • A program written in a high-level language may be translated into a low level language (the natural language of a computer) What is a computer? • A computer is a machine that executes programs (unlike a lawn mower) • A computer can execute any program (unlike a CD-player) • Since computers are Universal Machines, they are all fundamentally equivalent in computing power How do you write a program? • A computer can execute programs that are tools for creating programs • The programmer’s everyday tools are: – editor – interpreter or compiler – debugger • A suite of such tools is called an integrated development environment (IDE) • We are using the Idle IDE for Python The editor • An editor is used to write programs • Programs are written in plain text • The file containing the program in a highlevel language is called the source file • A Python source file has the extension ‘.py’ The interpreter • An interpreter translates from a high-level language to the computer’s language (instruction set) • The Python shell interprets line by line. • A line of computer code can not be translated and executes unless it is syntactically (grammatically) correct Debugging • Just because you’ve written some code doesn’t mean you’ve solved your problem. • Testing is the process of trying to discover errors in your program. • Debugging is the process of fixing errors you discover. • (The sentence ‘Colorless green ideas sleep furiously’ is grammatically correct, but what does it mean? Look in up on the Web.) Panic abatement advice • Expect to spend lots of time – Programmer wisdom: it always takes longer than you think • Expect things to go wrong – Murphy’s law of computers: anything that can’t go wrong, will – Don’t panic: every bug has a fix Tips for success • • • • Start every assignment early Don’t fall behind Ask if you don’t know Do your own work Getting help • Use the online help system • Every CA and instructor has office hours • Sign up for one of the study/homework sessions (hint: best right after class) • Learn to work with a partner or team as well as to tackle problems on your own. Grading • • • • • • • • Homework (almost every class) 15% Roadmap projects 15% Midterm 1 20% Midterm 2 20% Final 25% Misc 5% All sections have same work and tests Course is graded on a curve Attendance • Lecture attendance is mandatory (you are asked to sign in). Five absences will lead to withdrawal Homework • HWs are handed in paper (hard copy) and electronically • No late HWs will be accepted • Every HW hard copy must be neatly printed and stapled • Every HW must have student name and ID, date, HW # and section # Honesty • Cheating on an exam will result in failing the course • You may discuss HW problems with each other • You may not take credit for something you did not do
© Copyright 2026 Paperzz