CS 1: Fall 2015

Introduction to programming and computation

About the course

CS 1 is the header course for the Computer Science major and minor, and it is one option as the header course for the Digital Arts and Computational Methods minors. CS 1 fulfills the TLA distributive requirement, so you get both your Technology or Applied Science (TAS) credit and your lab credit.

You might think that this course is about computer programming. True, you will do a lot of programming. But that is not what this course is about.

Some day you will be a leader, a decision maker. As computer technology becomes more prevalent and pervasive in society, decision makers increasingly need to understand not just how to use the technology, but also the principles behind it. In this course, you will begin to learn about the principles behind computer technology. You'll start to understand why computers do the things they do.

More broadly, in CS 1 you'll learn to think about problems the way a computer scientist thinks. This skill is valuable in any field.


Hany Farid
Office Hours: Monday 3:00-4:00, Tuesday 3:00-4:00, and Thursday 4:00-5:00 in 159 Sudikoff. TAs will also be available in the seating area outside of my office on Monday 3:00-5:00, Tuesday 3:00-5:00, and Thursday 3:00-5:00.
If you'd like to meet with me outside of office hours, please contact me and we'll set up a time. Additionally, if my office door is open, feel free to drop in.

Course staff

Graduate TA: Shruti Agarwal

Section Leaders: Mazen Ammar | Elizabeth Brissie | Wanda Czerwinski | Stephanie Her | Acacia Hoisington | Maieda Janjua | Junmo Kim | Naho Kitade | Jai Lakhanpal | Margaret Lawson | Justine Lee | Ellen Li | Brandon Mader | Liane Makatura | Andrew Meier | Peter Saisi | Taeho Sung | Issa Sylla | Joshua Wan | Lily Xu | Angela Zhu

TAs: Raunak Bhojwani | Hao Chang | Trevor Davis | Mark Erwin | Chandler Gregg | Kaya Thomas | Thomas Kidder | Courtney Ligh | Kristen Vondrak | Daniel Whitcomb


We do not assume that you have prior programming experience. Indeed, historically, most students in CS 1 came in with no prior programming experience.

In addition, we'll be using a small amount of math. Do you know what it means to square a number? (Yes, of course you recall that it means to multiply the number by itself.) Do you know what a logarithm is? Don't worry about it if you don't remember logarithms, or even if they make you uncomfortable. The way we use them in this course, you'll understand them.


MWF 12:30–1:35 pm. x-hour is Tuesday, 1:00-1:50 pm. Location: LSC 100


We may periodically use x-hours, so please keep your x-hours available for this course.


I like it when you ask questions in lecture. I really do. I understand that it can be intimidating to raise your hand for a question in a large lecture, but please do not hesitate to ask questions. Don't worry about what anyone thinks of you for asking questions. Chances are that if you have a question, then at least one other student—and possibly many more—has the same question. You're doing the other students and me a favor by asking.

Laptops and phones

If you bring a mobile phone, please make sure that it does not audibly ring during lecture.

I realize that you might find it useful to read the programs or lecture notes on your laptop during lecture. However, a growing body of research has shown that use of laptops or mobile devices in the classroom leads to distractions and a corresponding reduction in comprehension and class performance. I, therefore, discourage you from using laptops during lecture. To minimize distractions to your fellow students, the central section of the lecture hall is a laptop-free zone. If you would like to use your laptop, please arrive early enough to secure a seat in the far left or far right sections of the lecture hall.

Recitation section

You are required to attend a one-hour recitation section meeting each week. Attendance is mandatory; section leaders will take attendance.

Complete and submit this form. We will determine the recitation section schedule in the first week of class and recitation sections will begin on the second week of classes.

If you say you are available during a one-hour slot, I expect you to honor this commitment. Please take this expectation into account as you make other commitments on and off campus this term.


There will be two midterm exams. If an academic scheduling conflict prevents you from taking one or both of the midterm exams at the scheduled time, you must let me know a week before the exam.

The final exam is scheduled by the Registrar and will be offered at one time, and one time only. The only way that you may take the final exam at another time is if you have a documented illness that prevented you from taking the exam at the scheduled time.

Before each exam, I will post a web page to help you review. There will also be review sessions during class or during x-hours.

There is no fixed scale for assigning letter grades. I expect the median grade for the course to be B+ or B, but I make no guarantees in advance.

Programming Drills

During your weekly recitation sections you will solve small programming problems. You must, therefore, bring your laptop to recitiation. There will be a total of 8 such problem sets. We will drop your lowest grade. You must attend your own recitiation to receive a grade from your section leader. If you miss a recitation, then there will be no way to submit a solution and you will receive a 0 for that week.

Your section leader will grade your work on a scale of 0 to 2.

Short assignments

Short assignments are relatively brief exercises that you will turn in at the next Monday, Wednesday, or Friday class. In some cases, you might have two classes to work on a short assignment. Short assignments will usually consist of one or two short programs to help you understand the concept being covered.

You will upload your short assignments in Canvas. They will have a timestamp, and so we will know when you submitted them. They are due at the start of class on the day they are due. We will not accept late assignments.

Your section leader will grade your short assignments on a scale of 0 to 5.

Lab assignments

In-depth lab assignments will be due on certain Mondays and Fridays through the course; you will have one week to work on each lab. You are not required to complete the lab assignment in the lab. You may use your own computer wherever you like, just as you do for short assignments.

Lab assignments require a significant time commitment. Start early, and if you need to, get advice from me, the section leaders, the TA, or at lab help hours.

Like short assignments, you will submit lab assignments in Canvas. They are due at the start of class on the day they are due. We will not accept late assignments.

Extra credit

Some of the assignments may suggest extra credit work. Extra credit in this course will be tallied separately from regular scores. If you end up on a borderline between two grades at the end of the course (or are being considered for a citation), extra credit will count in your favor. Failure to do extra credit will never be counted against you, however. You should do extra credit work if you find it interesting and think that it might teach you something. It never pays to skimp on the regular assignments in order to do extra credit problems.

One corollary of the way in which we count extra credit is that if you get a 30 on a lab assignment and also 5 points of extra credit, that is not the same as getting a 35 with no extra credit. The latter is far better.

How to get help

There are many ways for you to get help. You can visit me during office hours, you can go to lab hours when course staff is there, or you can make an appointment with me, your section leader, or a TA. It is often very difficult to provide help through email, so I strongly encourage you to attend office/lab hours.

The Tutor Clearinghouse is another source of help. They will have private, one-on-one tutors available for this class. The tutors are recruited on the basis that they have done well in the subject, and they are trained by the Academic Skills Center. If you are on financial aid, the College will pay for three hours a week of tutoring. To get a tutor, go to 301 Collis and fill out an application.

Lab help hours

Several days per week, course staff will be available to lend a hand with assignments or anything else you would like help with. We will hold these lab hours in LSC 200, where there are no computers. Section leaders will have their laptops, but it will probably be most convenient for you to show up with your own laptop.


The textbook is Think Python: How to Think Like a Computer Scientist by Allen B. Downey. The textbook is free. You can find it at this site, where you can either view it on the web or download it as a PDF.


We will be using PyCharm to edit and run code. You will install this software on your own computer as part of the first short assignment. Note that you can always email your program to yourself. So even if you normally run Windows but you want to work on an iMac in the lab, you’ll be able to work on your code.

The Web

All documents, class examples, lab assignments, short assignments, and sample solutions related to the course will be on the web: http://www.cs.dartmouth.edu/~cs1/ (the page that you are currently reading).

Honor Principle

Don't cheat. You know what cheating looks like and I know what cheating looks like. Don't do it. If you need more details on what constitutes cheating, read on.

On exams, all work must be your own. You may work on short assignments individually or in groups. Programs that you turn in, however, should be created, typed, documented, and output generated, yourself. For the lab assignments, you may consult freely with instructors and classmates during the phase of designing solutions, but you should then work individually when creating your programs—typing, documenting, and generating output. During the debugging stage you may discuss your problems with others in the class, but you should not copy code to "fix" bugs. To do otherwise is a violation of the Academic Honor Principle. If you work with a classmate on any assignment, you should tell us who you worked with in a comment at the beginning of your program.

You should attribute the proper source in any code that you submit that you did not write yourself. This includes code that you take from outside references—for example a book other than the course text. And it even includes code that you take from class examples, a book, or the assignments. (I agree that may be tedious to attribute the source in code that we have given you, but we want you to be in the habit of attributing your sources.)

Whenever we ask you to turn in sample runs of your program, the runs you turn in must be the result of actually running your program. It is a violation of the Academic Honor Principle to falsely represent output as coming from your program if it did not. If you change your program, make sure to generate output from the version of the program that you hand in. It's amazing how a seemingly minor change to the code can cause a big change to the output of a program. Also, make sure that when you are running a program, that it is your program; it is easier than you might think on a public Mac to run a program that someone else had left on the machine.

In the past, we have had a few incidents in which students turned in output that did not come from the program handed in. In each case, it turned out that the student had made a foolish mistake (in not rerunning the program or handing in an old version of the program or the output) and had not intended to misrepresent the work. Yet it caused many an uncomfortable moment for the student and also for the student's section leader and for the professor as well. So please verify that you're handing in output that comes from the very program you're handing in.

It is not easy to come up with good homework problems that help you learn a concept, are interesting, and require an appropriate amount of work. Over the years we have developed and refined a number of homework problems, and I plan to reuse some of them for this class. You should not look at any solutions to homeworks assigned in previous terms, including sample solutions, or solutions written by other students.

We have had some uncomfortable situations occur in the past, and I want to make it clear what the policy is. Two students, Alice and Ralph, discuss an assignment and design their code together. That is fine. But then they decide that since their programs would be so similar, they might as well have Alice type in the code, have Ralph make his own copy of the file containing the code, and then have Ralph make his own minor changes. This is a violation of the Academic Honor Principle. Although you may discuss and design with others, the code you hand in must be entirely your own.

Here's another situation that occurred. Trixie and Ed start working independently on a program. Trixie finishes and has a working version. Ed has trouble with his. Trixie helps Ed debug. That is fine. But then Trixie realizes that Ed has a section of code that is all wrong and the program she wrote has just the right code for that section. She shows Ed her program. Or worse, she gives Ed an electronic copy of her program so that he can just paste in the correct code. Either action is a violation of the Academic Honor Principle.

I realize that it can be hard to decide when you might be violating the Academic Honor Principle when we let you collaborate to a limited extent. Here is a good rule of thumb. If you are talking in normal English (or Chinese or German or some other natural language) you are probably OK. If you find yourself talking in Python code, you have crossed the line. So saying, "Your program runs forever because you have the wrong condition in the while loop" is OK. But saying, "Change while x == 0: to while x >= 0:" is not.

If you have any question about whether what you're doing is within the Academic Honor Principle, do not hesitate to check with me. If it's late and you can't find me, you're better off erring on the side of caution.

Most violations of the Academic Honor Principle come down to failure to cite work that is not yours. If you copy any portion of your program from your friend Elvira and represent it as your work, then you either intended to deceive or were careless about citing. Either case is a violation of the Academic Honor Principle. If you copy your entire program from Elvira but include the comment, "This code was copied in its entirety from Elvira," then you cited properly, though you didn't actually do the work. In this latter case, I would not report a violation of the Academic Honor Principle, though your grade on the assignment would be 0. But that would be far preferable to a COS hearing.

The same goes for code that you find in some other book or on the Internet. You are in violation of the Academic Honor Principle if you fail to attribute your sources.

You don't need to cite if you wrote the code yourself. You don't need to cite just because you're using a construct you saw elsewhere. For example, you need not cite for using print "something", even though it was in the class examples. That would be like citing "printing press" in an essay! Nor do you have to cite just because you use a while-loop, even though you saw a while-loop in a class example. It's when you lift several lines of code from elsewhere that you need to cite.

To cite, include in a comment—near the top of your file is fine—stating where you got the code from:

# Based on the say_introduction function in the January 7 lecture.

Please do not cheat. Cheaters—whether or not they are caught—bring dishonor upon themselves and upon everyone else at Dartmouth. To do that, for just a few lousy points in a course, is [insert your favorite strong adjective meaning "stupid" here]. Furthermore, if you cannot solve the short assignments and lab assignments on your own, then you will fail the exams, which are worth more than half of your final grade.

Special note for when you work on a computer that anyone else might use

If you are working on a computer that is not yours—especially a Mac in 003 Sudikoff—or that someone else in the course might use, you should be very careful to remove your code from the computer when you are all done. You should probably email your code to yourself before you remove the code. Why do we tell you to do this? Because if you leave your code on a computer, and someone else can see it, then they can copy it and hand it in. If that happens, then we have a bad situation involving you (the copy-ee) and the other person (the copy-er), and it's difficult—if not impossible—to tell who was the copy-ee and who was the copy-er. By removing your code from the computer when you're done, you can avoid getting yourself into that situation.

To remove your code, you'll want to delete it from the Eclipse workspace. And you'll also want to move any other copies on the computer to the Trash (or the Recycling Bin) and empty it.

Religious observances

Some students may wish to take part in religious observances that occur during this academic term. If you have a religious observance that conflicts with your participation in the course, please meet with me before the end of the second week of the term to discuss appropriate accommodations.


I encourage students with disabilities, including chronic diseases and learning disabilities, to discuss with me after class or during my office hours appropriate accommodations that might be helpful to you.

Students with disabilities enrolled in this course and who may need disability-related classroom accommodations are encouraged to make an appointment to see me before the end of the second week of the term. All discussions will remain confidential, although the Student Accessibility Services office may be consulted to discuss appropriate implementation of any accommodation requested.


Read the material I ask you to read, and follow the instructions. Many students have wasted a lot of their valuable time, and their grades have suffered, simply because they did not follow directions. Start all assignments early. With few exceptions, at the time you receive an assignment, you'll know everything you need to do it. There is no reason to procrastinate.

At the same time, do not be afraid to get help. The purpose of this course is not to waste your time. If you are spinning and not making progress on a problem, please see me, the TA, or a section leader. We can point you in the right direction without giving away the store.

Three final pieces of advice

  1. Don't fall behind in this course.
  2. Don't fall behind in this course.

The material in CS 1 builds on itself, and the pace is fast. As a result, it's easy to fall behind in this course, and if you do it's very difficult to recover.