Spring 2020 -- Peter Brooks
Here it is:
Project Master Link Page
Decide whether you want your name/project listed on the IntroCS-2
Project Page. It will look very much like the Personal
Homepage Link page we had early in the semester.
This is a great way to show your friends, family, creditors and enemies what a cool website you've put together.
So... Fill out this form
This is "opt-in", which means that:
0. If you don't decide, or you decide "no" then your name will not appear
1. If you fill out the form with "yes", then it will appear.
2. Individuals in partnerships can make individual decisions.
Thurs. 10:30a - 12:30p
Thurs. 4:00p - 6:00p
Thurs. 10:15p - midnight
Mon (6/15): noon - 2:00
Write me email when you'll be arriving...
Final project hand-in, June 12
No late penalty until Mon. morning 8:00am
|ZIP all of your files (both HTML and Python, but no data files) into a final.zip file. Upload that and put the URL for your landing page onto the Comments to Teacher.|
Personal Homepages Need to be Moved to Moe!
due Wed night (6/10).
The personal homepages that y'all created back in the beginning of
March need to move to Moe (if you need the "extra boost" I
promised). That's because the all of the main computers at
Stuy have gone down, and the building is off-limits at his time.
The Stuy computers contain your personal pages, and I need to
evaluate them to provide that "extra boost". However, I've not
been able to find the time until now that I have office hours, to do
the evaluation. In a wonderful instance of perfect timing, the
last Stuy computer went down today.
If you don't need that "extra boost", you do not need to move your homepage.
If you feel that you do but are unable to reconstruct your homepage on Moe, we'll need to figure out if and how to provide that "extra boost".
So... to move:
Copy all of your homepage files from your computer (remember, Marge, Lisa and Homer are down) up to your public_html directory (or a subdirectory of public_html that you create) on Moe. Test (test) (also test) your personal homepage and then put the URL onto the homework server slot that says: "Personal homepage on Moe". DO NOT PUT IT IN THE FINAL PROJECT SLOT!
|Hackathon for girls||June27. Online. Free. 7:00am - 7:00pm|
|Final project, due June 12||
1. The project must correspond, as closely as possible, to the proposal that I accepted on the homework server.
2. It must be thoroughly tested so that any bugs DO NOT CRASH it. If there are problems with what the user enters or selects, provide guidance to the user to get back on track.
3. The project must have an ABOUT page, with a prominently visible link to it on the primary page of the project (link either on top or bottom of the primary page).
4. Remember: if the Python program used by your website on moe has to write data to any files, those files must be located on your public_html/www directory.
5. Put the link to your primary page into the Comments-to-Teacher.
The ABOUT page should contain:
a) The name of the project
b) The author(s)
c) The intent of the project, and any instructions that are not elsewhere on how to use it successfully (with possible examples of its usage).
d) Any differences between what the project does and what the proposal said it would do (it would be best if I didn't find those differences myself)
e) Any bugs or problems that you are aware of that the user should avoid triggering (again, it would be best,...etc.)
f) Sources of information, sources of code, sources of data used.
g) Any interesting insights or experiences you've had in going through the creation journey.
h) Acknowledgements of those who helped.
How to set: set_cookies.txt
How to get: show_cookies.txt
Demo (V.2) http://moe.stuy.edu/~pbrooks/www/cookies_demo.py
|Keeping score in web interaction||
Using the <input type="hidden" HTML tag to keep score
and keep a history of previous pages that your user had just
Here's a demo of it.
Here's the Python program.
Here's the first HTML page (input_hidden_1)
|Personal Web Server||The PythonWebServer (pws-24) is now available. It is a webserver program that's designed to run on your laptop so you can try out and debug your websites without uploading them to moe. Feel free to use it, however I will not be able to debug installations of it if it does not quite work on your laptop (especially Macs). Follow the installation directions supplied by the link above. Nevertheless send bug reports to me.|
|Dojo is alive and waiting||dojofoshodo.slack.com|
|Project Proposal, due Sat. 5/30 midnight||
Write your proposal into the Comments-to-Teacher. Answer the
0. solo or duo? If duo, who is your partner? Also if duo, both of you MUST submit project proposals (probably identical)
1. a quick description of the website you're planning.
2. Why will the user return (possibly repeatedly) to your site? What value will the site have for the user?
3. If you're processing information obtained from elsewhere on the net, where is it coming from? Have you obtained it and looked at it to make sure that you'll be able to write a Python program to access the data that you'll deliver to your users?
|Remaining Daily Digital schedule||https://docs.google.com/spreadsheets/d/1VnkAsH5rJycu-QBzM3moxRMzex-9ZpsapD-DOixBTLg/edit?usp=sharing|
|Data sources galore!||Here are the data sources that y'all found on the net.|
Matplotlib example (histogram) and histogram/bar chart homework.
Due, Wed. 5/27 midnight.
Here's a complete running
matplotlib histogram example using the SAT-2010 and SAT-2012
datafiles from NYC Open Data.
Here's the homework: 2 histograms and one bar chart. There's been a fix to the data file used by this homework.
|Intro to Matplotlib||
This is a graph plotting package for Python. Quite easy to
use. Main docs are here at
We'll install it in Thonny on Windows, if it's not already installed, using Thonny's "Tools/Manage packages" menu item.
For Mac folks, if it's not already there, download the following version of Thonny:
Here's a video from Mr. Dyrland-Weaver on installing Matplotlib on Thonny.
Here's the tutorial you should go through for learning to use the pyplot object of matplotlib
|Homework -- first interactive page. Put a link to your working html page in the Comments-to-Teacher and also upload your Python file. Due, Fri, 5/22 midnight||
Create two files in your public_html directory: an HTML
page called "letter-form.html" asking a set of 3 questions used to
generate a letter, and a Python program called "letter-writer.py"
that processes the data when the button is pressed and sends the
typical web page below.
Note: Whatever the user fills in or does not, your program must not crash. If there's a problem, give the user a decent error message.
|Some cool projects from yesteryear|
|Webpage input controls (buttons, checkboxes, etc.)|
|First webpage with input||Html is here. Python is here.|
Random webpage time...
due Mon, 5/18
Let's try to write a random webpage. First, figure out how
to get random numbers from Python.
Then, let's use the data in the big SAT.csv file to report on a random school. Here's the main homework.
|Addressing Python execution problems.||
The Conditions for Peace
between Webservers and Python programs
|Python on the web server.||
Your first python-generate web page should be the following... On
moe, that you've logged into using either ssh or
putty, connect to your public_html directory and
using nano, create the following file called
first.py. Type the commands below exactly as they
appear. There are exactly 4 lines:
Having stored this into the file fred.py, now change its file permissions to executable using the command:
chmod +x fred.py
...and then you can test it by going back to your browser, opening a new tab and typing: moe.stuy.edu/~your-account/first.py
|Some recursive exercises, due Thu. night.||Here are my answers.|
|Fibonacci:||Here's what we covered on Friday: non-recursive and recursive functions for fib(), and how to time their execution.|
|2 quick recursions||
construct, for classtime, the two functions:
find(s,c) returns the position of the first occurrence of the character in argument c inside the string s, or -1 if c is not found
reverse(L) reverses the order of the elements in the list L
Here are some interesting solutions from students that we covered today...
|Daily Digital Presentation Schedule||https://docs.google.com/spreadsheets/d/1xSyJnzBQkx8XKpAI086kDlndDVOr2JlOm6Db6o68cI0/edit?usp=sharing|
Due: Wed. 5/6 midnight
|Problems are here.|
Assigment: You'll be calculating, writing answers, and finally writing
the HTML of a webpage with your Python program.
Due, Fri, 5/1 midnight.
|The Basel Problem.|
Let's find good sources of data!
Due Tues, midnight.
We'll take a quick look at
NYC Open Data,
and the next assignment is to go out there and fish...for
interesting, downloadable data.
We're looking for data that can be downloaded, can be processed by a Python program, is free (not behind a paywall), and is interesting. That amounts to pure textual files, or CSV or TSV files.
Report your data catch here: https://forms.gle/pSwLeUC7m4MW4MDC6
Your submissions have been reformatted into a web page, sorted by URL: DataSourcesWeb.html
Homework for Sat night, 4/25
Once more, here's the Table of Contents of the mini-tutorials:
Here's the homework -- you'll need
to read the SAT data file, split lines, convert strings to
numbers, handle names with commas embedded in them, and sort the
information ot get the value you need.
Best preparation: Read the mni-tutorials on Split and Join (see the TOC to the left) and the one on working with CSV files and Sorting.
|Wed. Apr 22 -- I won't be "in school" today (minor family issue).||
Read how to use the sorted() function in Python (there's section
Also, look at the following file SAT-2010-small.csv. It's a csv file, but some lines don't follow the expected "rules" and will crash your Python program if you're not aware of the problems. Find the problems (there are at least two different types of problems in this file). Look at the file with an ordinary text editor and also with a spreadsheet. We'll talk about this on Thurs.
Mon. Apr. 20. We're back!
Homework, due Tues, night.
Starting on file-reading & writing. We'll be using the
sections described here:(http://bert.stuy.edu/pbrooks/IntroResources/TOC.html
On the following topics:
File reading and Writing and Try/Except
Reading/Using CSV files
Assignment: Create a function MaxSalary(filename), that will read files just like the sample.csv file mentioned in the Reading/Using CSV files section, and returns a list containing the name of the person who has the highest salary, and the salary itself. Example:
print(MaxSalary('sample.csv')) # -> ['Voldy', 28.1]
Here's the file you'll use: salaries.csv
Put the answer into the Comments-to-Teacher, and upload the file to the homework slot .
|Tues, Apr. 7||Here are several explanatory pages on Python and the Python-HTML connection. Take a look at Split/Join|
|Monday, Apr. 6||
We'll still be using Zoom for a day or two, until transition to Google Meet or Microsoft Teams.
|Team puzzle competition from Harvard||
Daniel Lyalin from Period 4 Intro brings this to our attention:
11:08 AM (12 hours ago)
Hi, I've attached links to both the main page and puzzle packet for the 2020 CS50x Puzzle Day challenge.
No prior CS experience is necessary for the competition, though I'd argue some problems can be solved
via a well-designed program and some are easier to crack if you have computer science vocabulary knowledge.
Anyway, these problems are fun and help build logical thinking skills used in cryptography and programming.
just finished V.2 of the Schedule app that a lot of people have
been using (for years). I'd appreciate it if some of you tried
the beta-version out and told me of any issues it might have.
Testing will require downloading a free utility (one for Windows
users, another for MacFolk). Please send comments to me with the
Subject line: "Schedule V.2". Here is the beta:
Please read the Instructions found by pressing "Why a new version?" on the main schedule page.
|Homework due on Sun night on the homework server||
Here are String exercises, of
somewhat increasing usefulness (and difficulty). We're doing
cryptography and also some useful name processing. I've
included an optional Double Challenge problem.
Put all of the functions that you've created into a single .py file, and upload that to the homework server. While doing that, also put the answer to the optional Double Challenge problem into the Comments-to-Teacher.
|The Dojo is open for business||
Instructions from the Dojo-folks:
Dojo will now be available online through slack. Please share this link (https://join.slack.com/t/
|The News Literacy Project||This is an organization that detects misinformation/fake news in the news, particularly helpful with COVID misinformation. It is excellent, and I have been subscribing to it for years. Check it out and think about subscribing.|
Zooming. Looking at
ASCII coding and letter-shifting.
Do problems in the group: Character Manipulation
|Mr. K's CodingBat Problems||Here are the answers to Mr. K's CodingBat problems.|
Zoom Meetings, same schedule as school period times from now on,
including on Wed,
Conference Schedule days. Same Meeding ID and password as
Friday, and true going forward.
Today, we start on encryption.
A list of string methods can be found here.
Here are some string functions, a keyword and methods.
Do the first 4 exercises in Mr. K's "Character Manipulation" set.
Zoom Meetings, same schedule as Tues from now on, except on Wed,
Conference Schedule days.
Meeting ID/Pwd will be sent to you by email (keep that data).
The next set of exercises are Mr K's group: "String and Loops". Do not use the built-capabilities and functions: ".find", ".count", or the "in" operator -- I realize that removes shortcuts, but I'm getting you to do things with loops. Later, we'll use these methods and functions.
|The Daily Digital (DD)||
The Daily Digital consists of 3 tasks:
0) Choose a topic/event/accomplishment of newsworthy importance that has to do with the digital world that interests/intrigues you.
1) Write a paragraph or two explaining why it's interesting, and post it on the Intro QAF.
2) Report on it during a 5-minute DD session at the beginning of the period on the day assigned to you (each person will know in advance). There will be time for questions afterwards.
I've posted a sample DD in the QAF.
The Presentation Schedule
Regular meeting times (see Tues, below)
Period 4: Meeting ID: 164-555-967
Periods 8-10: Meeting ID: 148-166-363
|Wed., Mar 3/25||
This is a Conference day so the Zoom session times will move a
Meeting ID: 968-834-592
Period 4: 10:00
Meeting ID: 940-161-203
Period 8: 12:50pm
Period 9: 1:30pm
Period 10: 2:10pm
Do the exercises in the String-2 and List-2 sets mostly with for and a few with while. Note: the particular exercise: sum67 in List-2 is requires more thinking than usual.
What we covered: Splitting a non-negative integer into its ones digit and the rest. Given an integer n=157, we can do the splitting in two different ways: using arithmetic or using strings:
A) ones digit: n % 10 → 7 and the rest: n // 10 → 15
B)turn the number into a string using the str() function:
s = str(n) and ones digit is s[-1] → '7' and the rest is s[:-1] → '15'
We are going to do the numeric exercises in Mr. Konstantinovich's version of CodingBat: https://email@example.com/all
Starting on the exerecise groups: "Looping Numbers" and "Looping over Digits"
Zoom sessions at regular school period times:
Meeting ID: 805-292-466
Period 4: 10:20am
Office hours today: 12:00 - 1:00
Meeting ID: 512-797-337
Period 8: 1:25 pm
Period 9: 2:10pm
Period 10: 3:00pm
(no more 6:00 Catchall sessions...)
Do by today: Warmup-2 with while in CodingBat (even though you may have a shorter way of writing the code for some of these exercises).
Looping docs, new, improved -- now with for and other nutrients (range)
Same Zoom session times as Thursday.
Thonny: I mentioned that I was looking at a competitor to IDLE, called Thonny. Yes. Go to the Thonny site, read about its capabilities, then download and install (see installation instructions below), and try it. We'll be using Thonny for a while -- it's easier to show and test code in this split-screen environment. There's a quick tutorial video on that Thonny main webage.
Thonny installation instructions:
- The simplest is to go to the Thonny site: https://thonny.org/ and see at the top of the page the download links for Windows and Mac (and instruction for Linux)
- If you're having some trouble, here's a video on installing it.
CodingBat: Finish sections String-1 and List-1 by today. We are going on to looping. Assignment (=), decisions (if) and looping (while, for) are the basic dynamic operations in Python.
Looping docs (while)
Zoom sessions (Thursday) at regular school period times:
Period 4: 10:20am
Period 8: 1:25 pm
Period 9: 2:10pm
Period 10: 3:00pm
Could not make it to my to my regular time, session: 6:00pm
We'll be going over lists, so look at the handout below, and do the exercises, and have questions prepared. We'll also be looking at some more advanced list capabilities (list methods).
I showed a great website listing the most popular list and string methods (for Python 2.7). Here it is: http://rgruet.free.fr/PQR27/PQR2.7.html. Go to that page, and find the word "string" or :list" in the first section "Contents", and click on it.
|Wednesday: Lists: basics + CodingBat problems||
Here are the basic properties of lists.
Read every example next to the explanation and make sure you
understand it. If you don't, ask during the next Zoom
Regular CodingBat porblems: "List-1". Remember to log in.
|This is a slot for Covid-19 resources||"Social distancing" and "flattening the curve": Watch this video from the CDC (6.5 min).|
Tues, March 17
...moving into a new realm...
We're going to try out ZOOM!
If you cannot make your period's meeting time, there will be a 6:00pm session as well for anyone who couldn't make it previously.
Afterwards, fill out the survey form (even if
you couldn't make a session):
Monday, March 16
Schools closed until April 20.
We're starting a whole new way of learning/communicating, along
with the rest of the world. Stay tuned to this channel.
I am looking at some alternatives (like Zoom to talk with y'all
occasionally). Most of you (and by Mon afternoon, all of
you) have been signed up for the Google Group Intro QAF, for
questions and discussions.
|CodingBat problems solved by Sat. night (3/14)||
Votes due on the homework server by Sat. 3/14 midnight
They are HERE
The voting results are in.
|Python cribsheet||We will cover all of the aspects of the language that are detailed in the cribsheet.|
|Personal homepage (home-site), due Sun, 3/8 midnight.||
|Friday's test||Here are my answers.|
|Try downloading, installing and running Python by Mon, 3/2 classtime. Bring back installation warstories||Installing Python|
|Here's a list of the HTML tags you should know for Fri's HTML quizs|
|Sample of good student homepages|
|Unix commands quiz and answers (from last Friday)|
|Web Authoring tools, due Thurs. 2/27, midnight||
Find and evaluate free web authoring tools. That means look at
the descriptions and choose one or more, download it/them and
evaluate. Write a review on the Google Docs page hat you've
been sent a link for. The program should allow you to edit
both the visual version and the HTML version of your document.
If the tool that you've chosen to use is not on your own laptop (it's a web-based editor, running in your browser), then make sure that you can download the resultant HTML file that you creat, and that you can incorporate a picture that your have on your laptop into the document.
Here's a small demo of
CSS controls the visual style of the content of a page, although older HTML tags still do some (like <b> and <i>).
|First HTML homework, due: end of mid-winter break: Sun 2/23, midnight||
a) Construct a page that looks like this (your
can change the text, but it should have at least a numbered list and
a table with the same structure, at least a picture and a link to
some blissful nirvana).
b) Upload the html file to your public_html directory.
c) Create and test a URL that allows anyone knowing it to see your page over the internet
d) type that URL into the Comments-to-Teacher in the homework slot for this assignment
|HTML References found||
You should find a good site on the net that offers an HTML reference
and/or tutorial. You have been sent an invitation to add the
site you found to a table to show others in your class, along with
your quick review as to why it's good.
|Opportunities that have come wizzing into my emailbox:||
|Connecting to Stuy's computers from home:||Instructions here.|
Try using the "ls" command with directory arguments
For instance: After logging in, you'll be in your home
We're trying an experiment... An adventure game to learn
Get thee into a Terminal window (fast way: Ctrl-Alt t)
Read all of the instructions below before executing any of the commands (in red)...
Execute the following 3 commands exactly (note where the spaces and punctuation are)
scp -r 220.127.116.11:/stuyinstall/bashcrawl ./
After you execute that command, you'll be asked for your password. While you type your password, you won't see the letters you type ... that's all right, just finish and hit the Enter key. Lots of output will be sprayed at you. That's all right too.
In this game, you'll be entering rooms (actually directories) using the "cd" command, and then looking at the contents of a room (the files in the directory) using the "ls" command, and then perhaps, displaying the contents of files (partcularly the "scroll" file) using the "cat" command.
If you want/have to start over, type the "cd" command without arguments, and then continue with the red command above ("cd bashcrawl/entrance").
|First task: fill out your Profile on the Homework server.||
|Help from Mr. Brooks||Feel free to come and see me during periods 5, 6, or 7 in room 301 (just walk in) or by appointment beforehand just after school also in room 301.|
|Sending email to Mr. Brooks:
||Send mail to:
You MUST include your name in the subject line or body of the message, otherwise I won't know who it's from.
|Stuyvesant bell schedule|