Python Introduction course repository
This course is applied in the sense that it is a computer science class couched within the objectives of a social science class that, as part of a liberal arts education, seeks to teach you how to think and do research. As such, oftentimes the class material, which will focus primarily on the basics and helping everybody achieve a uniform understanding, will need to be augmented using a little bit of external research.
To that end, your success and enjoyment in this class will largely come down to whether you feel passionate enough about what we are learning - or, more importantly, how it can be applied to the things that you love - to want to go a little above and beyond to learn additional concepts. This is largely what the final group project is for: to encourage you to do a little bit of thinking outside the classroom using package repositories, documentation pages, stack overflow, and other resources to help hammer home the extensive breadth of the python programming language and its usefulness to you as a member of the social sciences community.
The final group project is the applied crux of the course. It invites students to do external research, but also leverage some of the ideas we've discussed in class, in the context of a group where you can delineate roles and build consensus around objectives and approaches. As such, I'm going to have students fill out questions in a Markdown project plan, where they can articulate what type of solutions, whether functional or object-oriented, that they plan to leverage, and start thinking through other questions like the data types that they'll work in and the external libraries that they'll leverage to complete their project. In a sense, you're doing a little bit of that research early on by filling the project plan out. I will assign groups in the first week, and then we'll discuss your final project and progress on your project plan during two conferences over the course of the class. While I will not dictate to you the best method to succeed in the final group project, I would encourage you all to meet outside of class sometime within the first week, and to meet as often as possible to fill out your project plan and start breaking down responsibilities.
Through careful engagement with the course materials, classroom discussion, external resources, problem sets, and group collaboration, I would like each student to develop broad, applied competencies in using python for the social sciences. As such, I have adopted the following objectives for this course:
- To understand how to set up a coding environment, leveraging package managers and version control systems.
- To understand how python variables work.
- To understand how python functions work and when it makes sense to use them.
- To understand how python classes work and when it makes sense to use them.
- To understand the basics of python data types.
- To understand how to use python builtin and community libraries - especially data science libraries like numpy, pandas, and matplotlib.
- To understand how different data storage systems like CSV, databases, and JSON work and when it makes sense to use each.
- To understand how to understand assumptions and test these to ensure code reliability.
This is a pass/fail class. As such, I expect that the vast majority of students will have no problem earning a passing grade. To do so, students must attend every lecture, complete all required problem sets, and submit a final group project. If you are unable to attend a class for any reason, you must email me beforehand and review the class recording. In these cases, I will generally expect you to complete and submit one of the non-required problem sets for the modules that we discussed in class that day to help ensure that you have taken the time to cover the materials discussed in class.
Problem sets are meant to be challenging but also provide a significant body of external resources to help you grasp the python programming language during this course and after you've completed it.
All resources and problem sets are optional unless marked as (required). Before the first week in class, please fill out the survey at *** placeholder to facilitate the creation of study groups constituting a mix of student backgrounds, experiences, and areas of study. Lecture Notes will generally come in two formats: markdown slides and Jupyter Notebooks. You can read the markdown slides directly in GitHub, where each horizontal rule separates two slides (see here for a quick markdown reference). Likewise, you can review Jupyter Notebooks from within GitHub (but, if you're having difficulty viewing them, you can paste the link to the page here and it should render properly) as well as in VSCode (when you are running the Jupyter Extension. We will spend the first class discussing how to make effective use of Lecture Notes and the Curriculum below.
In addition to Lecture Notes, I will generally post digital Problem Sets and Resources - again, all of these are optional unless marked as (required). Problem Sets will, in all cases, be written as Jupyter Notebooks. You should be able to read these in the browser, using Jupyter through your Anaconda Python installation, and/or in VSCode using the Jupyter plugin. These are written in such a way that you should be able to fill in your answers at the bottom of the Jupyter Notebook. Resources are a collection of reference material that may be useful to you when internalizing some of the concepts we are discussion in class.
One of the great things about programming is that there are a variety of ways to solve the same problem. Notwithstanding some solutions are more 'efficient' or 'paradigmatic' than others, the difference very often comes down to readability, simplicity, and intuitiveness. Often, my model solutions to our problem sets will fall short of the very best (read: efficient, paradigmatic) way to write the solution - because my goal in this class is to provide solutions that will be the most intellectually accessible, syntactically clear, and generally applicable for participants that may not have a computer science background. As such, I am not asking you to provide 'perfect' solutions, and indeed will often provide imperfect solutions myself, instead placing a premium on 'working code' that 'gets the job done'.
Python has an extensive community of developers and users. As a result, there is a substantial discourse over paradigms, conventions, and syntactical change. These are published in the Python Enhancement Proposals (PEPs), which can be found online and are a good resource on the language, along with Stack Overview, Real Python, and W3Schools.
*** The best way to approach this course is to create a github account and clone this repository. When you work on the final group project, you should write your code either in a separate repository or in one group member's clone of this repository.
- Lecture Notes: placeholder
- Problem Set 1.1.1 - install VSCode or VSCodium (required)
- Problem Set 1.1.2 - Python “Hello World!”
- Problem Set 1.1.3 - using replit as an IDE
- Resources:
- placeholder
- Lecture Notes: placeholder
- Problem Set 1.2.1 - install Anaconda (required)
- Resources:
- placeholder
- Lecture Notes: placeholder
- Problem Set 1.3.1 - Create a Github account (required)
- Problem Set 1.3.2 - Clone the Course Repository (required)
- Resources:
- Videos
- FreeCodeCamp Git and GitHub for Beginners - Please note, this is more comprehensive than we need for this course. You are welcome to review the entire video, but will likely find the first 30 minutes to be the most useful.
- Programming with Mosh Git Introduction
- Text
- Computer Science as a Discipline
- Videos
- Lecture Notes: placeholder
- Problem Set 1.4.1 - Create a virtual environment (required)
- Resources:
- placeholder
- Lecture Notes: placeholder
- Problem Set 2.1.1 - “labeling” and “referencing” objects
- Problem Set 2.1.2 - Using the
requestslibrary - Problem Set 2.1.3 - Using the
oslibrary - Resources:
- Lecture Notes: placeholder
- Problem Set 2.2.1 - Adding values between a range
- Resources:
- placeholder
- Lecture Notes: placeholder
- Problem Set 2.3.1 - Python Types and the
typinglibrary - Problem Set 2.3.2 - Lists, Dictionaries, and JSON
- Resources:
- Lecture Notes: placeholder
- Problem Set 2.4.1 - For- and While- Loops
- Problem Set 2.4.2 - If Statements and Operators
- Resources:
- Lecture Notes: placeholder
- Problem Set 2.5.1 - Create a class for a circle
- Problem Set 2.5.2 - Create a circle through inheritance
- Resources:
- An old, but good, discussion of principles in python classes https://www.youtube.com/watch?v=HTLu2DFOdTg
- Lecture Notes: placeholder
- Problem Set 3.1.1 - placeholder
- Resources:
- placeholder
- Lecture Notes: placeholder
- Problem Set 3.2.1 - placeholder
- Resources:
- placeholder
- Lecture Notes: placeholder
- Problem Set 3.3.1 - placeholder
- Resources:
- placeholder
- Lecture Notes: placeholder
- Problem Set 3.4.1 - Relational Data: SQL and CSV
- Problem Set 3.4.2 - Document Data: NoSQL and JSON
- Problem Set 3.4.3 - Graph Data: Neo4j and Surreal
- Resources:
- placeholder
- Lecture Notes: placeholder
- Problem Set 4.1.1 - Using
assertandtry/exceptstatements - Problem Set 4.1.2 - Writing and raising
Exceptions - Problem Set 4.1.3 - Writing a Basic Test Suite
- Resources:
- Python Assertions https://realpython.com/python-assert-statement/
- Different ways to write a doctring https://stackoverflow.com/a/24385103/13301284
- Another resource for writing docstrings https://www.programiz.com/python-programming/docstrings
- Guest Speaker: placeholder
- Lecture Notes: placeholder
I worked closely with Dr. Sam Hulse in the development of this curriculum and owe him many thanks for his suggestions on teaching methods, topics, and the development of problem sets.