SYLLABUS#

Introduction to Python | Fall 2024


COURSE OVERVIEW#

Welcome to COGS 18! The core goal of this class is to teach you introductory, hands-on skills for computer programming, specifically using the Python programming language. We aim to do so in a way that fits well within the cognitive science department, using particularly-relevant use cases. Our approach is to focus on programming as a tool and to get you started with the necessary background and basic skills required to get you reading and writing code. We aim to provide you with a strong foundation so that you can continue programming after you leave this class, applying the skills you learn here to your domain or topic of interest.


COURSE INFORMATION#

Lecture: TuTh at 11:00a-12:20p (YORK 2722) OR 3:30p-4:50p (PETER 110) Labs: Mon OR Wed 9a-6p (CSB 115) (Please go to your assigned section)

Office Hours Times/Locations and Coding Lab TAs/IAs can be found on Canvas.

Important Links

*You will be able to post anonymously on Piazza; however, you will only be anonymous to your classmates. The instructional staff will be able to see who you are.


COURSE OBJECTIVES#

Our main goal is that you are able to program at an introductory level in the Python programming language at the end of this course. To that end we expect that you will be able to:

  • Read basic Python programs, recognizing the structures used (i.e. variables, conditionals, loops, functions) and explaining how they work

  • Write Python code to solve basic computational problems

  • Debug small Python programs by identifying and fixing the bug(s)

  • Execute Python programs in Jupyter notebooks and from Python scripts

  • Demonstrate familiarity with the command line

  • Describe and implement best practices (code style, documentation, and testing) in Python

To achieve these objectives, information will be presented during lecture. You will have the opportunity to program in lecture, during, and throughout all assignments. Examples throughout this course will be related to cognitive science, focusing on data analysis, artificial intelligence, human-computer interaction, and programmatic thinking.


COURSE MATERIALS#

  • All materials will be provided via the course website and datahub

    • Software (optional): Python >=3.6 (Anaconda distribution); Jupyter Notebooks (this will be available on datahub)

    • No required textbook; optional textbook: https://shanellis.github.io/pythonbook (currently under development; feedback welcome)

  • iclicker (optional) will be used for in-class questions and provide an opportunity for extra credit; either the app or a physical iclicker is fine

Detailed instruction for software installations/access will be listed on the course website and provided across the first coding lab. All of the software is freely-available for download.

Note: If you do not have consistent access to the technology needed, please use the form below to request a loaner laptop: https://eforms.ucsd.edu/view.php?id=490887. (For any issues that you may have, please email vcsa@ucsd.edu and they will work to assist you.)


GRADING & ATTENDANCE#

Grading:

% of Grade

Requirement

Assignments

40%

Complete 5 Assignments

Midterms

25%

Complete 2 Exams

Coding Labs

15%

Participate in 8 Coding Labs (lowest lab dropped)

Final Project

20%

Complete Final Project OR Final Exam

Grades#

All grades will be released on Canvas. It is your responsibility to check that your assignment was submitted, that your grade is accurate, and to get in touch if any are missing and/or you think there is a problem.

To calculate final grades, I use the standard grading scale and do not round grades up:

Percentage

Letter Grade

97-100%

A+

93-96%

A

90-92%

A-

87-89%

B+

83-86%

B

80-82%

B-

77-79%

C+

73-76%

C

70-72%

C-

60-69%

D

<60%

F

Assignment Regrades#

We will work hard to grade everyone fairly and return assignments quickly. And, we know you also work hard and want you to receive the grade you’ve earned. Occasionally, grading mistakes do happen, and it’s important to us to correct them. If you think there is a mistake in your grade on an assignment, post privately on Piazza to “Instructors” using the “regrades” tag within 72 hours. This post should include evidence of why you think your answer was correct and should point to the specific part of the assignment in question.

Note that points will not be rewarded if you fail to follow instructions. For example, if the instructions say to name the variable orange and you name it ornage (misspelled), you will not be rewarded credit upon regrade. This is because (1) following instructions and being detail-oriented is important and (2) there are hundreds of students taking the course this quarter.

In-person illness policy#

Please do not attend any in-person activity (lecture/coding lab/office hours) if you are feeling ill, especially if you are sneezing/coughing and have a fever. If you feel mildly ill but without sneezing/coughing, or if you have allergies or similar, then you may come to in-person events while wearing a well-fitting mask.

Lecture#

Students are encouraged to attend lecture live; however, in-person attendance is not required, except on exam days. All lectures will be podcast. However, during lecture, students will be given time to complete small coding challenges on their own, and will have the opportunity to see their classmates’ thoughts during lecture.

To incentivize attendance, we will use iclicker for in-class Q&A (using either a physical iclicker or a remote). Students will receive a small amount of extra credit for each lecture attended, up to a total of 2% extra credit. To earn credit in a given day, students must respond to at least 50% of the questions asked on that day (correctness does not matter). Students are free to attend either lecture time except on Exam days. Note that students must create an iclicker Student account using your ucsd.edu email. See instructions here.

Coding Labs (15%)#

Lab times will be used to get hands-on practice with the course material in a smaller group setting. As such, you will be provided with specific tutorials or activities each week that are focused on preparing you for the assignments. Across the quarter there will be 8 different coding labs (lowest coding lab score dropped). Coding labs are graded for concerted effort (not correctness). To receive credit for a coding lab, you have to submit your attempted coding lab for the week by that Wednesday 11:59 pm. There are no late submissions for coding labs.

Assignments (40%)#

There will be five assignments, each worth 8% of your final grade. Assignments will be hands-on coding assignments. Assignments are to be completed individually and submitted on datahub. You will typically have about 3 days after release to complete each assignment. Assignments will be due at 11:59 PM on the assigned date.

Late assignments will be accepted at 75% credit for 72 hours (3 days) after the assignment’s due date. Once the late deadline passes, assignments will be graded, feedback will be made available on datahub, and assignments will no longer be able to be submitted for credit.

You are personally responsible for understanding everything you turn in. While you may ask one another about assignments, you may not copy directly from a classmate. And, you may not post full assignments nor any part of any assignment on the Internet (i.e. Chegg, Discord, Piazza, or related site). Evidence of cheating on an assignment will result (at minimum) in loss of a full letter grade in the course.

Midterms (25%)#

There will be two (2) midterms. The midterms will have two parts: 1) a conceptual, in-person portion taken on the day of the exam in class and 2) a shorter, technical, take-home portion, released at 4PM on the day of the in-class exam and due that night (see Course Schedule). The in-class portion will be closed-notes. The take-home portion will be open-notes and open-Internet. All parts will be completed individually. Students will not be permitted to discuss the questions on the exam with anyone until both parts are submitted.

Students must attend the lecture time for which they are enrolled on webreg on exam days.

As former students know, I take academic integrity seriously, but I also trust most students to do the right thing. I would rather spend more time teaching and less time ensuring that there is no way for students to cheat because let’s be honest…there’s always a way to cheat. I trust and am confident that the vast majority of students care about their education enough to take this seriously and am unwilling to spend all my energy focused on those students who do not. That said, students should anticipate that if they are caught cheating on an exam, they will fail the class. ::steps off soapbox::

Final Exam or Project (20%)#

Students will choose whether they complete the final project OR the final exam, worth 20% of your final grade. Students get to choose which option is best for them but may only submit one and there are two limitations of choosing the final exam 1) There is no opportunity for extra credit on the final exam, and 2) you cannot get help from anyone else while taking the final exam.

Final Project You will learn more from the final project than you will from the final exam, but the project is more time-consuming and involved. We will discuss the details elsewhere; however, briefly, you will either (1) expand upon one of the class assignments adding original elements or (2) write original code for a project topic of your choosing. The goal of this project is to demonstrate that you can write good, well-documented code that solves the problem you’ve set out to solve.

Final Exam The final exam will be take-home and you will have at least 48 hours to complete the exam. It will be the completion of a guided mini-project, focusing on the material learned in the last third of the course. Additional details will be discussed in class.


COURSE SCHEDULE#

Date

Week

Day

Lecture topic

Lab topic

Assignment due (11:59 PM)

9/26/2024

0

Th

Introduction

9/30/2024

1

M/W

CL1 - tooling

10/1/2024

1

Tu

Variables & Operators

10/3/2024

1

Th

Functions

10/7/2024

2

M/W

CL2 - vars, operators

10/8/2024

2

Tu

Conditionals

10/10/2024

2

Th

Collections

10/14/2024

3

M/W

CL3 - funcs, conditionals

10/15/2024

3

Tu

Debugging [*]

10/17/2024

3

Th

Loops

10/18/2024

3

F

A1 - variables, comparison, functions

10/21/2024

4

M/W

CL4 - collections

10/22/2024

4

Tu

Review

10/24/2024

4

Th

E1

E1: technical portion (take-home)

10/27/2024

4

Su

A2 - conditionals, collections, ciphers

10/28/2024

5

M/W

CL5 - loops

10/29/2024

5

Tu

Methods

10/31/2024

5

Th

Classes

11/1/2024

5

F

11/4/2024

6

M/W

CL6 - classes

11/5/2024

6

Tu

Command Line [**]

11/7/2024

6

Th

Modules

11/8/2024

6

F

A3 - loops, strings, chatbots

11/11/2024

7

M/W

CL7 - command line

11/12/2024

7

Tu

Review

11/14/2024

7

Th

E2

E2: technical portion (take-home)

11/17/2024

7

Su

A4 - methods, classes, agents

11/18/2024

8

M/W

11/19/2024

8

Tu

Scientific Computing

11/21/2024

8

Th

Documentation

CL8 - scientific computing

11/22/2024

8

F

11/25/2024

9

M/W

11/26/2024

9

Tu

Code Testing

11/28/2024

9

Th

Thanksgiving Holiday

12/2/2024

10

M/W

CL9 - test, debug, refactor

12/3/2024

10

Tu

Code Projects

12/5/2024

10

Th

Wrap-up

12/6/2024

10

F

A5 - numpy, pandas, refactoring

12/11/2024

Finals

W

Final project/exam due

Final Exam/Project: Final Projects/Exams (you’ll chose one) are due on the date of the scheduled final exam by 11:59 PM. You do not have to show up anywhere at the scheduled date/time of the final.

Notes: [*] denotes the last day of material covered on Midterm I (E1). [**] the last day for material on Midterm II (E2).#

OTHER GOOD STUFF#

Piazza Rules#

Piazza is an incredible resource for technical classes. It gives you a place to post questions and an opportunity to answer others’ questions. We do our very best as an instructional staff to answer each and every question in a timely manner. We also want to make sure this platform is being used to learn and not thwarting anyone’s education. To make all of this possible, there are a few rules for this course’s Piazza:

  1. Before posting your question, look at questions that have already been posted to avoid duplicates.

  2. If posting about an assignment, note title should have assignment number, question number, and 1-2 words about the question. (i.e. A1 Q1 Variable Naming)

  3. Never post an answer to or code for an assignment on a public post. Pseudocode is encouraged for public posts. If you must include code for an assignment, make this post private on Piazza.

  4. Your post must include not only your question/where you’re stuck, but also what you’ve already done to try to solve it so far and what resources (class notes, online URLs, etc.) you used to try to answer the question up to this point.

Class Conduct#

In all interactions in this class, you are expected to be respectful. This includes following the UC San Diego principles of community.

This class will be a welcoming, inclusive, and harassment-free experience for everyone, regardless of gender, gender identity and expression, age, sexual orientation, disability, physical appearance, body size, race, ethnicity, religion (or lack thereof), political beliefs/leanings, or technology choices.

At all times, you should be considerate and respectful. Always refrain from demeaning, discriminatory, or harassing behavior and speech. Last of all, take care of each other.

If you have a concern, please speak with the professor, your TAs, or IAs. If you are uncomfortable doing so, that’s OK! The OPHD (Office for the Prevention of Sexual Harassment and Discrimination) and CARE (confidential advocacy and education office for sexual violence and gender-based violence) are wonderful resources on campus.

Academic Integrity#

Don’t cheat.

You are encouraged to work together and help one another. However, you are personally responsible for the work you submit. For assignments, it is your responsibility to ensure you understand everything you’ve submitted and to make sure the correct file has been submitted and that the submission is uncorrupted. Please review academic integrity policies here.

Cheating and plagiarism have been and will be strongly penalized. If, for whatever reason, Canvas or DataHub is down or something else prohibits you from being able to turn in an assignment on time, immediately email the professor or else it will be graded as late.

Policy on using Artificial Intelligence programming assistance#

I believe that using large language models (LLMs) or other kinds of AIs can help a good programmer work more efficiently. I also believe that relying on AI assistance will almost certainly slow down the development of a beginning programmer into a good programmer.

My advice: if you struggle to conceptualize how you want to write a program you should probably NOT use an LLM (or at least not right away). The beginning or intermediate programmer needs to practice their craft… just like you will never get to be great at a video game by just watching other people’s speed runs. I think its fine to use AI assistance if you can immediately imagine how to solve the problem, but you just want help with implementation details, to see alternative algorithms you could use, or help writing it faster.

Note that LLMs are most helpful in learning when you determine the questions to ask it and interpret the answer, NOT when you copy+paste questions from assignments in directly and then copy+paste the answer it spits out. For example, if a question in this class asked you to “write a function that takes two parameters income, tax_rate that will calculate how much you owe in taxes”, you would NOT just copy that question into ChatGPT/CoPilot/etc. Instead, you would attempt the question on your own and then ask specific questions on parts of the question you don’t understand. For example, you may ask the LLM, “what does it mean for a function to take two parameters?” This way you ensure you’re understanding and maximizing learning. (Also, note that example question was intentionally not detailed enough to actually get you a “right” answer for such a question but to serve as an example for what it means to ask your “own” questions.)

You can use AI to help you program as long as you:

  • make a code comment that cites the AI used, and provides an estimate of how much code in a given block is machine generated. For instance you might write this # The (code/design) of this function is (completely/mostly/partially) generated by Github Copilot from the prompt "write a python function to bubble sort a list" Feel free to include a description of any specific changes you made from the machine generated code… it was edited to reduce execution time, to deal with edge cases, to deal with an empty data file, etc..

  • don’t assume LLM code is working and just hand it in without checking. You are always responsible for functionality and understanding how something works.

  • understand that programming with LLMs still requires you to do programming. But instead of creating code from scratch (the part many people enjoy) you will need to do debugging and unit testing (the part many people don’t like)

  • you understand that you may be asked to explain your code at any time. A helpful heuristic can be to ask yourself “Can I explain each piece of code and each analysis carried out in what I’m submitting? Could I reproduce this code/analysis on my own?”; you should be able to answer “Yes” to both questions for everything you submit in this course. If you can’t explain how your code works and why the design is that way, you may lose points.

Also note that while AI typically gives you the right answer for programming questions, it will occasionally give you a very wrong answer, and if you don’t know enough about programming to know when an answer is wrong, it will bite you on the butt.

Disability Access#

Students requesting accommodations due to a disability must provide a current Authorization for Accommodation (AFA) letter. These letters are issued by the Office for Students with Disabilities (OSD), which is located in University Center 202 behind Center Hall. Please contact the professor privately to arrange accommodations.

Contacting the OSD can help you further:
858.534.4382 (phone)
osd@ucsd.edu (email)
http://disabilities.ucsd.edu

Difficult Life Situations#

Sometimes life outside of academia can be difficult. Please email me or come to office hours if stuff outside the classroom prevents you from doing well inside it. I can often refer you on to the help you need.

If you don’t have the most essential resources required to thrive as a student, please contact UCSD Basic Needs who can help you access nutritious food and stable housing, and help you seek the means to reach financial wellness.

If you need emergency food, finances, and/or academic and social support you can also contact UCSD Mutual Aid. They provide mentoring and aid that comes from volunteers among your peers. If you don’t need that kind of support, consider joining them in helping your fellow classmates who do.

If you need counseling or if you are in a mental crisis you can contact CAPS. They provide psychiatric services, workshops, and counseling; they also operate a 24/7 crisis hotline at 858.534.3755.

How to Get Your Question(s) Answered and/or Provide Feedback#

It’s great that we have so many ways to communicate, but it can get tricky to figure out who to contact or where your question belongs or when to expect a response. These guidelines are to help you get your question answered as quickly as possible and to ensure that we’re able to get to everyone’s questions.

That said, to ensure that we’re respecting their time, TAs and IAs have been instructed they’re only obligated to answer questions between normal working hours (M-F 9AM-5PM). I know that’s not when you may be doing your work. So, please feel free to post whenever is best for you while knowing that if you post late at night or on a weekend, you may not get a response until the next weekday. As such, do your best not to wait until the last minute to ask a question.

If you have:

  • questions about course content - these are awesome! We want everyone to see them and have their questions answered too, so post these to Piazza!

  • a technical assignment question - come to office hours (or post to Piazza). Answering technical questions is often best accomplished ‘in person’ where we can discuss the question and talk through ideas. However, if that is not possible, post your question to Piazza. Be as specific as you can in the question you ask. And, for those answering, help your classmates as much as you can without just giving the answer. Help guide them, point them in a direction, provide pseudo code, but do not provide code that answers assignment questions.

  • been stuck on something for a while (>30min) and aren’t even really sure where to start - Programming can be frustrating and it may not always be obvious what is going wrong or why something isn’t working. That’s OK - we’ve all been there! IF you are stuck, you can and should reach out for help, even if you aren’t exactly sure what your specific question is. To determine when to reach out, consider the 2-hour rule. This rule states that if you are stuck, work on that problem for an hour. Then, take a 30 minute break and do something else. When you come back after your break, try for another 30 minutes or so to solve your problem. If you are still completely stuck, stop and contact us (office hours, post on Piazza). If you don’t have a specific question, include the information you have (what you’re stuck on, the code you’ve been trying that hasn’t been happening, and/or the error messages you’ve been getting).

  • questions about course logistics - first, check the syllabus. If you can’t find the answer there, first ask a classmate. If still unsure, post on Piazza.

  • questions about a grade - Post on Piazza with “regrades” tag in a private post to “Instructors”.

  • something super cool to share related to class or want to talk about a topic in further depth - feel free to email the professor or come to office hours. Be sure to include COGS18 in the email subject line and your full name in your message.

What should I call you?#

I should call you by your preferred name, with the correct pronunciation. Please correct me (out loud in the moment, via email/Piazza after the fact, or however you’re most comfortable) if I ever make a mistake.

What should you expect of your interactions with instructional staff?#

Interactions with instructional staff (professor, TAs, IAs) will be:

Dialog-based: We will use dialog-based teaching rather than monologues. When students have questions that require a lengthy explanation of a concept that was covered in lecture, we will refer you to an external resource (e.g. lecture, site, video) for you to look at first. Of course, if you have questions about what you learn in those resources, please ask us! We want to make sure that everyone has done the preliminary background work so that we are using our time most effectively.

Student-driven: Rather than tell you how to solve a problem, we aim to ask you questions and point you toward illustrative examples to help lead you toward finding a solution on your own.

Example-heavy: We will ask you about previous example problems you may have seen in lab or lecture that might be helpful to the problem at hand. When you look through examples you’ve seen, you might be able to find one that’s relevant to your problem and use it as inspiration for a solution. Also, when we know which examples you’ve seen and which ones you understand or don’t, we can better pinpoint where your confusion lies.

Scaffolded with prior knowledge: If you’re lacking prerequisite knowledge needed for the question you’re asking, we take a step back and cover that before returning to the problem.