SYLLABUS#

Introduction to Python | Spring 2024

v.1.0.2 (Apr 9)


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-12:20 (PETER 110) OR 2-3:20 (WLH 2001)
Labs: on the hour 9-5 Wed and Fri (CSB 115)

Office Hours Times/Locations, Coding Lab Staff, and Staff pictures 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

Surveys

4%

Complete pre- and post-surveys

Assignments

30%

Complete 5 Assignments

Midterms

30%

Complete 2 Exams

Coding Lab

16%

Participate in 8 Coding Labs

Final

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 (given the numerous extra credit opportunities offered):

Percentage

Letter Grade

97-100%

A+ (final project) / A (final exam)

93-96%

A

90-92%

A-

87-89%

B+

83-86%

B

80-82%

B-

77-79%

C+

73-76%

C

70-72%

C-

67-69%

D+

63-66%

D

60-62%

D-

<60%

F

The “I already know Python” Grading Policy#

If you have to take this course to fulfill a requirement but are already very familiar with the course content, there is an option for you! I’m interested in student learning, not busy work, so if you already know the material, let’s save you some time. Students who choose this option only have to complete the pre- and post-surveys, two midterms (both the in-person and take-home portions) and either the final exam or the final project. The surveys will still be 4% of your grade. Each midterm will count for 30% of your final grade and the final will count for 36% of your final grade. Students may opt-into this at any time during the quarter up until the due date of the final by filling out this form; however, once you opt in you cannot change your mind. For example, if you decide in week 4 that you want to opt-in and then bomb the first exam, you cannot change your mind in week 6, as you would then be behind, would have missed some deadlines, and dealing with this logistical nightmare would not be fair to course staff. That said, if you’re on the fence, I’d encourage you to complete the course as designed until you’re certain you want to go this route.

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 5% extra credit (for those who attend every lecture) on their final project/exam (not the final course grade). 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.

Pre- and Post-Assessment Surveys (4%)#

Students will be required to complete two pre-course assessment surveys (2%) as well as a post-course assessment survey (2%). These will be used to learn a bit more about you as a student as well as your knowledge in Python. (Note: you are NOT expected to have any Python knowledge at the start of the course.) Completion of these surveys is required in COGS 18; however, students will choose whether their responses can be used for future research. Students will earn credit for completion and are not graded on correctness.

Coding Labs (16%)#

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 (2% each; 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 that week by Friday at 11:59 pm each week. There are no late submissions for coding labs.

Note: You should be signed up for the Coding Lab for which you can attend. However, if you are unable to attend the Coding Lab for which you are signed up, you are free to attend the other Coding Lab in a given week. Note that this policy could change if too many people are attending one Coding Lab each week. We intentionally have Coding Lab capped at 35 so that students can get help from their TAs and IAs during this time.

Assignments (30%)#

There will be five assignments, each worth 6% 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 1 week 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 (30%)#

There will be two (2) midterms. Each midterm 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.

Note that we will scan your exams into Gradescope and grade within Gradescope, so while you won’t have to do anything in Gradescope to complete your exam, this is where you will see your feedback.

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 Project OR Exam (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 three limitations of choosing the final exam 1) There is no opportunity for additional extra credit on the final exam, 2) you cannot get help from anyone else while taking the final exam, and 3) the highest grade you can get if you choose the exam is an A. (To earn an A+, you must do the final project.)

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

Assignment due (11:59 PM)

4/2/2024

1

Tu

Introduction

4/4/2024

1

Th

Tooling & Variables

4/9/2024

2

Tu

Operators

Complete pre-assessment survey (#finaid)

4/11/2024

2

Th

Functions

4/12/2024

2

F

CL1 - tooling, variables, operators

4/16/2024

3

Tu

Conditionals

A1 - variables, comparison, functions

4/18/2024

3

Th

Collections [*]

4/19/2024

3

F

CL2 - functions, conditionals, collections

4/23/2024

4

Tu

Catch up & Review

A2 - conditionals, collections, ciphers

4/25/2024

4

Th

E1

E1: technical portion (take-home)

4/26/2024

4

F

CL3 - review

4/30/2024

5

Tu

Loops

5/2/2024

5

Th

Classes

5/3/2024

5

F

CL4 - loops

5/7/2024

6

Tu

Classes

A3 - loops, strings, chatbots

5/9/2024

6

Th

Command Line [**]

5/10/2024

6

F

CL5 - classes

5/14/2024

7

Tu

Catch up & Review

A4 - methods, classes, agents

5/16/2024

7

Th

E2

E2: technical portion (take-home)

5/17/2024

7

F

CL6 - command line

5/21/2024

8

Tu

Python Party

5/23/2024

8

Th

Scientific Computing

5/24/2024

8

F

CL7 - scientific computing

5/28/2024

9

Tu

Documentation

5/30/2024

9

Th

Code Testing

5/31/2024

9

F

CL8 - testing

6/4/2024

10

Tu

Code Projects

A5 - numpy, pandas, refactoring

6/6/2024

10

Th

Wrap Up

6/7/2024

10

F

6/11/2024

Finals

Tu

Final project/exam due; Complete post-assessment survey

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 probably 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 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.

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.

  • some feedback about the course you want to share anonymously - If you’ve been offended by an example in class, really liked or disliked a lesson, or wish there were something covered in class that wasn’t but would rather not share this publicly, etc., please fill out the anonymous Google Form*

*This form can be taken down at any time if it’s not being used for its intended purpose; however, you all will be notified should that happen.

What should you call me?#

Most students call me Prof/Professor Ellis. I’m also perfectly happy if you call me Shannon (not all professors are OK with that kind of informality) or Dr. Ellis. I would prefer you not address me as Ms/Miss/Mrs. Ellis.

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.