This notebook will guide through the tools you will need for class materials and assignments, and how to get them.
How excited are you for COGS 18?
This course and associated materials do not presume any prior knowledge of Python, or programming in general.
To work with the course materials, you will need make sure you have access to the tools tools described here on datahub.
It will be helpful for the final project if they are also installed on the computer you will be using.
None of the materials are computationally heavy.
UCSD hosts its version of JupyterHub and calls it datahub. This is what you'll be using in class.
It is available here: http://datahub.ucsd.edu
Once you've logged into datahub, click on the the following link: https://datahub.ucsd.edu/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2FCOGS18%2FLectureNotes-COGS18&urlpath=tree%2FLectureNotes-COGS18%2F&branch=main
(This link is also on the Canvas home page.)
print()
statements encouragedFor Submission:
Before you click submit, make sure it's the thing you want to submit
You *must click submit*.
Always check that the CodingLab/Assignment/Exam shows up under "submitted assignments"
You can submit as many times as you want
We only have access to your most recent submission
If you submit past the deadline, we will only have access to your late submission
TimeZones: https://www.timeanddate.com/time/map/
To get a quick tour of the Jupyter user-interface, click on the 'Help' menu, then click 'User Interface Tour'.
There are also a large number of useful keyboard shortcuts. Click on the 'Help' menu, and then 'Keyboard Shortcuts' to see a list.
Cells are an independent 'unit'. When you click into a cell, you can 'run' it by clicking Shift + Enter, or by pressing the play (Run) button above.
Cells come in different types for writing different things - mainly, text or code.
Cells, can be markdown (text), like this one.
A brief note about Markdown. It's a way to specify all formatting within the text itself.
For example, italicized text can be specified with an underscore or single asterisks.
Bold text requires two underccores or two asterisks.
What does three underscores around text accomplish?
you can write/edit your markdown text here to determine the answer to the question
Lists are also possible:
What would happen if I specified a numbered list but put the same number before each list item?
test it out down here to see...
list item list item list item
Whenever you're writing code, you'll want to be sure the cell is set to be a code cell
# Cell can also be code.
a = 1
b = 2
# Cells can also have output, that gets printed out below the cell.
c = a - b
print(c)
# If you execute a cell with just a variable name in it, it will also get printed
c
Write code that outputs the value '6'
## YOUR CODE HERE
Which of the following best describes you?
?
after a function or class get a window with the documentation, or a double ??
to pull up the source code.
# For example, execute this cell to see the documentation for the 'abs'
abs?
# Move your cursor to the end of the line, press tab, and a drop menu will appear showing all possible completions
ra
# If there is only one option, tab-complete will auto-complete what you are typing
ran
You only need access to datahub for this course, but for working on your projects and for downloading and opening the notebooks used in class, you may want to download anaconda onto your computer, which comes complete with conda, and Jupyter notebooks.
# You can check which python you are using, and what version it is.
# Once you have installed anaconda, you should see you are using Python in your anaconda folder
# Make sure that the version you have is 3.6 (or at least 3.X)
# Note: these are command-line functions that may not work on windows
!which python
!python --version
If you click on the url in the browser, you will notice it says 'localhost'. This means it is connected to something locally, on your computer.
That local connection is to the 'kernel'.
We've had some issues in the past, so we're trying to be incredibly explicit this quarter so that we're all on the same page. (And, because this differs from some other courses.)
Correction: It was for one exam; it was not constant. And it was 6/100 (which is 6% of the class!)
I came into this class knowing absolutely nothing about coding. Being in this position, I have made it my goal to go above and beyond in learning about programming languages that I am unfamiliar with because I personally like a challenge and I love learning new things.
Because coding does not come naturally to me, I plan WAY ahead of time as to when I need to sit down, uninterrupted, to really learn, make mistakes, and test out the code I write in assignments. For example, I plan DAYS ahead of time as to when I need to sit down and complete assignments. Again, because coding does not come naturally to me, I spend on average 2 hours more than the median hours/time spent listed. Not only do I spend hours completing assignments to the best of my ability, but I make sure to test out EACH AND EVERY PIECE of code I wrote in these assignments to make sure my code is “spitting out” what I am expecting, and to show you and the TAs what I was trying to do just in case I get something wrong (because showing work for some points is better than showing no work for 0 points, you know?)
Each student has their method, and planning out WHEN to work and HOW LONG to work on assignments is my method; I just think it is a shame that students resort to cheating when things get tough or they are too lazy to actually learn, because again, that is unfair to me as a student who dedicates time and energy to every assignment in this class.
- Former COGS 18 Student
The most important reminder: you must have written, understand, and be able to explain any code you turn in as your own.
When can you work with others in COGS 18?
Working with others is different than copying from others. It is never acceptable to just ask someone for their answers or their code.
On Coding Labs & Assignments, it is OK to ask one another questions about what you're working on. It is OK to share screens and talk through your answers.
If you find yourself copying + pasting someone else's code (from a friend or from the Internet)...you're probably making a mistake.
When can you NOT work with others?
Exams are the only time in this course we ask you to work on material completely on your own.
Exams assess your understanding after you've had plenty of practice (in lecture, on coding labs, and on assignments).
It's your time to show off what you know.
Exams are open notes and open Google.
You can search the Internet for help on concepts.
You are not allowed to ask anyone specific questions from the Exam or post the questions anywhere.
Part of your first Coding Lab will help to make this all as clear as possible!