Introduction to Programming

University of California - Davis

Introduction to programming and problem solving in Python. Aimed primarily at non-major students.
Get Access

24HR Notes for ECS 32A

Available 24 hours after each lecture

Max Nelson

ECS 32A Syllabus for Max Nelson — Winter 2019

ECS10 Winter Quarter 2018
Instructor : Nelson Max,
Office: (for private appointments) Kemper 3108 (in a small side corridor beyond two
consecutive doors at the north end of the main north south corridor on the third floor)
e-mail: (I may not promptly read e-mail evenings and weekends.) Please
do not send me e-mail via canvas. Instead use my normal U C Davis e-mail address.
office phone: 752-3798
home phone: 510-482-5558 (do not call after 10:00 PM)
office hours: 3:10 to 4:55 PM, Monday, Wednesday, Friday, 78B Hutchinson (left side of room 78)
textbook: The textbook for ECS10 this winter will be an online e-book from the
zyBooks company, which you will need to purchase for $77 from,
because their system is needed for online grading of "Participation Activities",
“Challenge Activities” and Programming Homework. When you sign in to purchase the
book, you will be asked to submit an e-mail address. Please use your official U C Davis
e-mail address ending in This will allow us to interface the grades on the
zyBooks site with the gradebook on the Canvas site here at Davis. You will need a credit
card for the purchase, but if you do not have one, you can purchase a prepaid credit card
and use it instead. zyBooks offers full refunds during the first 30 days, so please
purchase the book even if you are on a waiting list or are not sure you will remain
in this course, in order not to lose course credit for online work. The ordering
instructions from zyBooks are:
Sign up at
Enter zyBook code UCDAVISECS032AWinter2019
Select your class section and enter your student ID
Click Subscribe
TAs Qi Wu:
Ayush Jain:
Chongruo Wu:
Forum The grading for this course will be entered on its Canvas web site, so you can see your
grades there. However, we will not be using its Chat feature. Instead, we will use Piazza.
You can sign up for Piazza at and the main
page to start on after that is . The TAs
and professor will share responsibility for monitoring the site, but please feel free to
answer your fellow students’ questions. Also, before you post a specific question, please
check whether another student has already done so. Finally, be sure to use a private post,
visible only to the professor and TAs, if you include more than a line or two of code in
your post. (See the discussion below on plagiarism.) You are encouraged instead to ask
questions about your code in person in lab sessions, rather than via Piazza. In both cases,
we may not be willing to answer a question like “Here is my code. Why doesn't it
work?” unless you show some evidence of trying to figure out for yourself where the
problem may be.
Grading: 50% programming assignments
10% Participation Activities
5% Challenge Activities
10% Midterm, Friday February 8
25% Final Exam, March 21
Lecture Video Our lectures will be videotaped. Lecture Capture recordings for ECS 32A can be
accessed by clicking on the "Lecture Videos" tab in the ECS 32A Canvas course site. If
that does not work, look for them in the Media Gallery. The lecture recordings will be
available approximately 2 hours after the completion of each class, and until the end of
the Spring 2019 quarter. So if you need to miss class because of illness, or want to
review the material, these videos will be useful. In fact, they may allow you to
concentrate on the concepts in the lecture, rather than on taking notes. But if taking
notes helps you concentrate during lecture, please do so. The capture system is not
guaranteed to work perfectly, so please do not depend on it for all lecture content.
(Please remind me if I forget to put on the microphone.) If you postpone attending or
looking at the lectures for too long, you will fall far behind and have trouble catching
up. Note also that even if you do not attend a lecture, you are still responsible for doing
the Participation and Challenge Activities assigned with it before the deadline. Privacy
notice: recordings can run from 5 minutes before to 5 minutes after the scheduled
lecture time, and the camera will typically be on a wide shot of the room. If the room
microphone is on, room audio will also be recorded.
Lab hours 2:10 PM to 6:00 PM, in 78B Hutchison (area on the left side of room 78 as you enter the
door). TAs will be available for most of these hours, in a schedule to be announced later.
Most of you will probably choose to do your python programming on your own computers, but there
are also rooms where you can use U C owned computers. Tim Leamy, who manages these instructional
Windows computer labs writes “We’ll have Python 3 and PyCharm installed on the open-access lab
PCs at 182 Shields, 102 Wellman, 246 MU, 78 Hutchison, 2101 SCC, and 15 Olson (never any
classes). You can see when they are open and how many PCs are free at They are also available in the IET Virtual Lab
( The IET Virtual Lab allows UC Davis students, staff and faculty
access to computers in closed rooms after hours. So your students can use it to do Python homework
after the labs close. If you have any trouble with logging in or computer hardware, look for the
Computer Room Consultant in the blue vest.”
The student user files on these IET computer lab machines are wiped clean every night, and there is no
student file storage on these machines. Thus you will need to copy your work onto a USB flash drive or
onto Google drive or e-mail it to yourself before you leave the lab, if you have not yet uploaded it to
Canvas. You are not required to use any of these IET labs. You can download and install the Python 3
system onto your own computer from the website, and do your homework at
home or elsewhere. If you have a laptop, you can bring it to lab hours for help with the installation.
You can visualize the execution of a python program using,
and use a python tutorial at . You can also use the IDLE
development environment to develop your code. It is available in the labs in Hutchinson and SciLab,
and will automatically be included if you install python3 on your Windows computer. You can learn
how to use it by clicking the “Help” menu item at the top of the screen, and then the IDLE Help item in
the sub-menu. But the description there of the IDLE debugging features is not very detailed, so I
suggest instead that you look instead at .
A more elaborate development environment called PyCharm is also available in the labs. You can also
download a free student version of PyCharm from . PyCharm has
more functionality than IDLE, but is therefore harder to learn. I will be using IDLE in class. You can
also access some free textbooks from when on campus or
using the Library VPN ( Head First
Python is a very popular beginning Python programming book available for free on that site.
You will need to upload your programming homework to the zyBooks site, where it will be
automatically graded. You will get immediate feedback about how your program’s output compared to
the correct output, both for any public test cases, and for any non-revealed test cases. You may resubmit
it as many times as necessary before 11:59 PM on the due date, and the highest score will be counted.
But please debug it on your own, rather than depend only on the feedback from the grading system.
You may continue to resubmit it until 11:59 PM on the expiration date, and the highest of either 50% of
the best late submission score, and 100% of the best of any on-time submissions, will be your final
Plagiarism Please be aware that your assignment source code will be downloaded from the Canvas site
after the assignment expires, and compared with other students' work, and to online sources, to detect
plagiarism. It is not prohibited to get programming help from another student, a TA, the professor, or an
other source, but you are required to acknowledge this help in a comment in your source program. You
can insert a comment either between a # character and the end of the current line, or in a multi-line
block with three consecutive signs before and after it (see Construct 5.3.1 in section 5.3 of our
textbook). Even that acknowledgement does not excuse direct copying of most or all of someone else’s
work. Be aware that all submissions will be investigated for plagiarism, so if you submit a plagiarized
version first as a test, and then develop and submit your own versions later, you are still guilty of
Please be careful when asking questions about your work on Piazza. If you need to include your
complete source code in a Piazza post, please make sure that the post is a private one, visible only to
the professor and the TAs. If you find such code on Piazza that was inadvertently posted, copying it
without attribution still constitutes plagiarism. In general, even acknowledgment of a location from
which you copied too much of your code will probably reduce your score on that assignment.
Plagiarism will be reported to the Office of Student Support and Judicial Affairs (OSSJA). More than
one incident of academic misconduct will lead to increased disciplinary sanctions, potentially including
suspension from UC Davis. If you let another student look at your code to explain one detail, that
student might end up taking a picture of your entire code and using it. In that case, in the case of
including your code in a public Piazza post, or the case of sending the assignment description to a
problem solving web site (all these things happened the last time I taught this course), and other
students have code similar to yours, you will also be included in the group flagged for plagiarism. The
spirit of this plagiarism policy is described well at Professor Amenta’s winter 2013 ECS10 (an earlier
version of ECS32A) web site:
“You should write each line of your program yourself, and you should know what it does and
why it is there. To check yourself, you should type each line of your program yourself; never copy or
cut-and-paste from another file. While you're typing, ask yourself, do I know what this line does? Why
am I including it in this program?
Often the easiest way to write a program, even in industry, is to take an already-existing
program that does something similar, and change it around. This is fine in "real-life", but in this class, it
is better not to cut-and-paste whole programs or even single lines, since as a beginner you need to
concentrate on every line. [But it is OK to cut and paste text strings for a print() statement.] You should,
however, look very carefully at the example programs from lecture or the textbook, and figure out how
your programs should be similar or different.
Writing programs can be very, very frustrating. Sometimes you don't know how to start.
Sometimes your program seems perfect, but it doesn't do what you think it should be doing. We want
you to talk to the other students, to friends who are programmers, to the TAs, to anyone who can help!
We want you to show them your programs and ask them what's wrong. But make sure when the
conversation is over that you understand every line of your (hopefully improved...) program. If your
friend is telling you exactly what to type, you are cheating.
If you are looking at another student's program to help them, that is not cheating. If you are
showing another student your program to help him or her, that is cheating. If you are looking at another
student's program while typing in yours, or if you cut-and-paste from another student's program, that is
obviously cheating and you are very likely to be caught.
You will quickly see that there are always many, many ways to write a program for a
particular programming assignment, just like there are many ways to write an essay for a particular
English assignment. And it is almost as easy to recognize two almost identical programs as it is to
recognize two almost identical essays. For some of the assignments in this course, we will [sometimes]
use software to detect almost identical programs. If you find yourself changing around someone else's
program to try to fool the detection software, you are cheating.”
In the past, I used to give a F for plagiarism only on the assignment in question, but there is
now a new policy in the CS department (see
usp=sharing) that encourages me to give an F for the whole course, and I will probably follow this rule,
which also applies to cheating on exams. The U C Davis Code of Academic Content that this policy
refers to is reproduced below:
The University of California, Davis CODE OF ACADEMIC CONDUCT Honesty, Fairness, Integrity
This Code of Academic Conduct exists to support high standards of behavior and to ensure fair
evaluation of student learning. Students who violate the Code of Academic Conduct are subject to
disciplinary sanctions that include censure, probation, suspension, deferred separation or dismissal
from the University of California. Unless specifically authorized by the instructor in writing,
misconduct includes, but is not limited to the following:
Academic misconduct on exams or other coursework
• Copying or attempting to copy from another student, allowing another student to copy, or
collaborating with another student on an exam.
• Displaying or using any unauthorized material such as notes, cheat-sheets, or electronic devices
• Looking at another student’s exam
• Not following an instructors directions regarding an exam.
• Talking, texting or communicating during an exam
• Altering assignments or exams for re-grading purposes
• Bringing pre-written answers to an exam
• Having another person take an exam for you, or taking an exam for another student
• Theft of academic work
• Unexcused exit and re-entry during an exam period
Taking credit for any work created by another person. Work includes, but is not limited to books,
articles, experimental methodology or results, compositions, images, lectures, computer
programs, internet postings
Copying any work belonging to another person without indicating that the information is copied
and properly citing the source of the work
Using another person’s presentation of ideas without putting such work in your own words or
form and giving proper citation
• Creating false citations that do not correspond to the information you have used
• Plagiarizing one’s own work
Unauthorized collaboration
• Working together on graded coursework without permission of the instructor
• Working with another student beyond the limits set by the instructor
•Providing or obtaining unauthorized assistance on graded coursework
Misuse of an instructors course materials or the materials of others:
• Posting or sharing any course materials of an instructor without the explicit written permission of
that instructor
• Purchasing or copying assignments or solutions, to complete any portion of graded work, without
the instructors permission
• Unauthorized use of another student’s work
Lying or fraud:
• Giving false excuses to obtain exceptions for deadlines, to postpone an exam, or for other reasons
• Forging signatures or submitting documents containing false information
Making false statements regarding attendance at class sessions, requests for late drops,
incomplete grades, or other reasons
Intimidation or disruption:
Pressuring an instructor or teaching assistant to regrade work, change a final grade, or obtain an
exception such as changing the date of an exam, extending a deadline, or granting an incomplete
grade • Refusing to leave an office when directed to do so
Physically or verbally intimidating or threatening an instructor, teaching assistant or staff person,
including yelling at them, invading personal space, or engaging in any form of harassment
• Repeatedly contacting or following an instructor, teaching assistant, or staff person when directed
not to do so
• Misusing a classroom electronic forum by posting material unrelated to the course
Interfering with an instructors or teaching assistant’s ability to teach a class, or interfering with
other students’ participation in a class by interrupting, physically causing a disruption, or
excessive talking
Upholding the UC Davis Code of Academic Conduct
Students, faculty, and University administration all have a role in maintaining an honest and secure
learning environment at UC Davis.
The success of our Code of Academic Conduct depends largely on the degree that it is willingly
supported by students. Students:
• Are responsible to know what constitutes cheating. Ignorance is not an excuse.
• Are required to do their own work unless otherwise allowed by the instructor.
• Are encouraged to help prevent cheating by reminding others about this Code and hold each other
accountable by reporting any form of suspected cheating to the University.
Shall respect the copyright privileges of works produced by faculty, the University, and other
copyright holders.
Shall not threaten, intimidate or pressure instructors or teaching assistants, or interfere with
grading any coursework.
• Shall not disrupt classes or interfere with the teaching or learning environment.
Faculty members and instructors are responsible for teaching courses and evaluating student work,
and are governed by University of California and UC Davis policies and regulations. Regulation 550 of
the Davis Division of the Academic Senate addresses academic misconduct. Faculty and instructors:
Will provide students with a course outline containing information about the content of the
course, amount and kind of work expected, examination and grading procedures and notice of the
Code of Academic Conduct.
• Should monitor examinations to help prevent academic misconduct.
• Shall report all suspected cases of cheating and other misconduct to the Office of Student Support
and Judicial Affairs (
The University has delegated authority and responsibility to the Office of Student Support and
Judicial Affairs (OSSJA) for the adjudication and resolution of academic misconduct cases. OSSJA
maintains records of academic misconduct. The University:
• Shall educate faculty and students about the Code of Academic Conduct.
Shall provide physical settings such as classrooms and labs for examinations that minimize
opportunities for academic misconduct.
Shall assist and train faculty and teaching assistants about how to prevent and address academic
Submitting Reports and Judicial Procedures
• The Code of Academic Conduct governs academic conduct at UC Davis.
Faculty have sole authority, as granted by the Academic Senate, to evaluate a student’s academic
performance and assign grades. If academic misconduct is admitted or is determined by
adjudication to have occurred, instructors may assign a grade penalty no greater than “F” for the
course in question. If a report is pending at the end of an academic term, instructors should assign
a temporary grade of “Y” for the course until the report is resolved.
A faculty/student panel, convened by OSSJA, shall conduct formal hearings to adjudicate
contested cases of academic misconduct, unless the right to a formal hearing has been withdrawn.
The right to a formal hearing may be withdrawn because of a prior finding of misconduct.
Instructors and teaching assistants may direct a student to leave a class immediately if the
student’s behavior is disruptive.
Instructors, teaching assistants and staff persons should contact police (752-1230 or 911) if they
feel physically threatened.
All zyBooks Participation Activities are due at 10:00 AM the class day they are discussed for book
sections listed in the schedule below (except this for sections 1.1 and 1.2, which are due on January 9).
There may also be Challenge Activities assigned, which due by 11:59 PM the day they are listed. All
Participation Activities for listed sections are assigned, but not necessarily all Challenge Activities, so
please see the details below in this syllabus for which Challenge Activities are due. I have discovered
that Activities where you need to type at most one line into a box can be checked by simply pressing
the Enter key after the typing, without clicking the Check box on the web page. Note that the half credit
by a later expiration date, described above for homework, does not apply to these Activities; if you
miss their deadlines you will get no credit. The online version of this syllabus in the Files section of
Canvas will be updated if schedule information is revised, and you will get a Canvas broadcast e-mail
announcing any changes, so please check your U C Davis e-mail regularly.
The drop deadline for this course is January 18. If you are thinking of dropping, please decide
early, so others can take your place. I do not have the authority myself give anyone a PTA. Please
see for the Computer Science department policy on PTAs.
Initial Reading, Participation Activities, Challenge Activities, and Programming Homework
Monday January 7: Sections 1.1 and 1.2.
Wednesday January 9: Sections 1.3 and 1.4. Participation Activities (Due by 10:00 AM) on sections
1.1, 1.2, 1.3, and 1.4. Challenge Activities (Due at 11:59 PM): 1.3.1, 1.3.2, and 1.3.5. Programming
Homework 1 due 11:59 PM Monday January 14, expires Wednesday January 16: 1.12: ASCII Art, 4
points. (Points show relative weight only; they do not add up to the 50 mentioned above under
Friday January 11: Sections 1.5, 1.6, 1.7, and 1.10. Participation Activities in these sections (not
mentioned from now on, but always due on listed sections). Challenge Activity 1.4.1. Programming
Homework 2 due Thursday January 17, expires Tuesday January 22: 1.13: Converting inches to
centimeters, 4 points.
Monday January 14: Sections 1.8, 1.9, 2.1, 2.2 and 2.3.
Wednesday January 16: Sections 2.4, 2.5, and 2.6. Challenge Activities 2.4.1, 2.6.1, and 2.6.2.
Programming Homework 3 due Thursday January 24, expires Monday January 28: 2.12: Molecular
weight, 4 points.
Friday January 18. Sections 2.7, 2.8, 2.9 and 2.11. Challenge Activities 2.7.1, 2.9.1, and 2.9.2.
Monday January 21: Martin Luther King holiday.
Wednesday January 23: Sections 3.1 and 3.2. Challenge Activities 3.1.2, 3.2.1, 3.3.1, and 3.3.2.
Friday January 25: Sections 3.4, 3.5, and 3.7. Challenge Activity 3.4.1. Programming Homework 4
due Friday February 1, expires Tuesday February 5: 4.9: Painting a wall, 8 points.
Monday January 28: Sections 3.8, 3.9, and 4.1. Challenge Activities 3.8, 3.8.2, 4.1.1, and 4.1.2.
Wednesday January 30: Sections 4.2, 4.3, and 4.4. Challenge Activities: 4.2.1, 4.2.2, 4.2.3, 4.3.2, 4.3.3,
and 4.4.2.
Friday February 1: Sections 4.5, 4.6, 4.7, and 4.8. Challenge Activities: 4.5.1, 4.5.2, 4.6.1, 4.8.1
Monday February 4: Sections 5.1, 5.2, 5.3, and 5.4. Challenge Activities: 5.2.2, 5.2.3, 5.3.2, 5.3.3,
5.4.1, and 5.4.2. Programming Homework 5 due Friday February 8, expires Wednesday February 13:
5.15, Adding numbers within a string, 5 points.
Wednesday February 6: Sections 5.5, 5.6, 5.7 and 5.8. Challenge Activities 5.5.1, 5.5.2, 5.6.1 and 5.8.1.
Programming Homework 6 due Wednesday February 13, expires Tuesday February 19: 5.14:
Enhanced Molecular Weight, 9 points. This assignment requires significant thinking, so do not wait
until the last minute.
Friday February 8. Midterm exam.
Monday February 11: Sections 5.9, 5.10, 5.11, 6.1, and 6.2. Challenge Activities: 5.10.1, 6.1.1, 6.1.2,
6.2.1, and 6.2.2.
Wednesday February 13: Sections 6.3, 6.4, 6.5, 6.6, and 6.7. Challenge Activities: 6.3.1, 6.3.2, 6.6.1,
6.6.2. Programming Homework 7 due Wednesday February 20, expires Monday February 25: 6:18:
Seating a large group at multiple tables, 6 points.
Friday February 15: Sections 6.8, 6.9, 6.10, and 6.11. Challenge Activity 6.9.1.
Monday February 18: President’s Day holiday.
Wednesday February 20: Sections 6.12, 6.13, 6.15 and 7.1. Challenge Activity 6.13.1.
Friday February 22: Sections 7.2, 7.3, and 7.4. Challenge Activities 7.2.1, 7.3.1, 7.3.2, 7.4.1.
Programming Homework 8 due Tuesday February 26, expires Friday March 1: 7.6: Grade Point
Average (GPA). 4 points.
Monday February 25: Sections 8.1, 8.2, and 8.3. Challenge Activities 8.1.1, 8.2.1, 8.3.1, 8.3.2.
Wednesday February 27: Sections 8.5, 8.6, 8.9, and 8.10. Challenge Activity 8.5.1.
Friday March 1: Sections 8.12, 8.13, 8.14, and 8.15. Challenge Activities 8.12.1, 8.14.1. Programming
Homework 9 due Tuesday March 5, expires on Friday March 8: 8.16: Soccer team roster
(Dictionaries), 11 points.
Monday March 4: Sections 10.1, 10.2, 10.3, and 10.4.
Wednesday March 6: Sections 10.5, 11.1, 11.2, and 11.3. Programming Homework 10 due Monday
March 11, expires Friday March 15, 11.8: Multiple committees, 8 points.
Friday March 8: Sections 11.4, 11.7, and 12.1.
Monday March 11: Sections 12.2, 12.3, 12.5, and 12.6.
Wednesday March 13: Sections 9.1, 9.2, and 9.3. Challenge Activities 9.2.1, 9.2.3, and 9.3.1.
Friday March 15: Sections 9.4, 9.5, 9.6, 9.7, 9.8 and 9.9. Challenge Activities 9.6.1, and 9.8.1.
Thursday March 21: Final Exam, 1:00 – 3:00 PM. Room 1001 Geidt (our normal classroom).
Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.