I debated whether or not to provide actual code of different types of programs you could write and I have decided against it for a couple of reasons. First, there are different ways of creating a program that work and I would prefer not to keep you from discovering and learning your own method. Second, there is no need for exact code as the intention of programming in the classroom is not to create "THE" program, but to more deeply understand a particular concept or achieve a certain goal.
That being said, I will gladly provide examples if requested in the comments or by email.
Before we do that, though you might be wondering how to fit this into your classroom. I would say that it comes up in my classroom every time I want to describe an algorithm or concept more deeply with them. First we talk about the process and then we create pseudocode. Which is a fancy way of saying that we just write down what the program should do even if we don't know the exact syntax for it.
For example in our Gaussian addition problem earlier this week, the pseudocode would look like this:
sum = 0
Go through a loop from 1 to 100
Add the current number in the loop to sum
When the loop is finished print sum to the screen.
This demonstrates that the student understands the concept and there is no need to actually go program it in Python but it is extremely satisfying to do so. Whenever I am asking the students to use pseudocode before they actually program it, I say to them, "What are the steps necessary to make this happen". When they think they have their code, they pass it to another student who essentially runs through the program line by line on paper or in their head and checks to make sure that this is what the computer would actually need to accomplish the task.
If you have the class time because of
video tutorials or maybe you have some time you would have otherwise spent on a worksheet or movie, then this is a perfect time to do it. The reinforcement and deeper understanding your students will get is well worth the time devoted to it.
Otherwise I know teachers have had success by assigning it for homework (just make sure your instructions and support are there or students will get frustrated) and/or extra credit. Sometimes the best way is to create a lunchtime or
after school program, as you can really dig in deep and work primarily with those who are interested. Ironically, those students came back to the classroom and demonstrated what they were able to do and others who might not have initially done it were excited to try once they knew that it could be done.
Here are some examples or ideas to get you going. Remember, you can use the python tutorials and resouces to create these programs, or use pseudocode to get the concept down with your students.
Biology
DNA to Protein program which takes a line of DNA code and through the process of transcription and translation turns it into amino acids. While this program reinforces the concepts, it also is a powerful way of showing how a deletion or insertion into the DNA by mutation or copying error can dramatically effect the outcome of the protein.
Evolution: While reading Richard Dawkins'
The Blind Watchmaker, he mentions that the anecdote of the million monkeys typing away to produce Hamlet, could not likely happen if it were purely random. However, in the biological world, that which works is retained while the rest is discarded. In order to illustrate this point, I created a program that would have a "monkey" randomly typing letters, but every time he would get a letter that matched with the correct letter and placement in Shakespeare's story, it would keep it and throw the rest away. When I run this program, it typically takes under an hour and says that it would take a thousand attempts or so. Powerful demonstration, especially when discussed along with Hox Genes and other "toolbox" genes that make it relatively easy for an organism to become another one entirely.
Physics:
Projectile Motion programs are great fun because of the many variables for students to modify. There is a great bit of add on software to Python called
Vpython which allows you to have visual objects move on the screen according to the data (you can also create graphs and such). If you go to the documentation example on the VPython page, it will actually walk you through an example of a bouncing ball to get you started. I used this in my Physics of the Absurd project where the students created projectile motion animations of crazy word problems that they had made up (e.g. Superman jumping to the moon). Students also enjoy creating artillary games where the goal is to input the right angle, and exit velocity to hit a certain target.
Math:
Factoring is an excellent concept to adapt to programming as it is one of the most well known applications of math in programming. For example our security encryption and transactions are safe because no one has created a program that can quickly factor a large composite number. Euclid's algorithm is a great example of an algorithm for factoring, but perhaps your students will create a new more efficient one. Maybe they will prove the Riemann Hypothesis and collect the one million dollar prize from the
Clay Institute (and share it with their former teacher).
Slope Art is a project I do every year because the students have a lot of fun and learn a great deal about the concept of slope from doing it. I will post more about this project later as I am refining it from last year. It involves creating
string art by using Vpython and inputting the slopes and equations. This project is perfect because it is self correcting (i.e. if the code does not match their picture then they determine where they went wrong).
Sage:
A program worth mentioning especially if you wish to implement
Python into your classroom. It not only contains Python but additional functions and libraries in math that can take you from basic algebra to graduate school mathematics. My favorite part of it, and why I am recommending it to you is if your students sign up for a free account, they will have access to a "notebook" which will save their programs and allow them to work anywhere they have access to an Internet Browser, so there is no need to install Python. This is especially helpful if you need to work on school laptops that do not have Python installed on them or work a bit at school, save it and then continue at home.
Calculation and Conversion:
This is what got me into programming my TI calculator back in High School and I suspect will have the greatest practical value to your students. There are many times where it would be nice to have a program that could do the work for me (e.g. quadratic equation, conversion from inches to meters, pH, etc). I tell the students they can use programs on their graphing calculators but only if they can prove to me that they wrote them or if we have created one in class.
Fun:
Personally, I think all of these examples are fun but I have a lot more background in this and your students might get frustrated or lose interest. It is a great idea to start off with something to hook them in and keep them coming back for more. A lot of students love creating those RPG games using print and input (example: "you are standing in a dark forest, you have a flashlight and a pencil, what would you like to do?") or having discussions with the computer like, "Hello, what is your name?" the student types in their name, and then the computer says, "Hello Phil!"
Another easy way to get them hooked is the Turtle module built into Python. If you remember Logo from the older days then you will recognize the familiar look. It is basically a drawing program with commands like "Forward 100" and "Right 90". Here are all of the commands from the
Python Documentation. Students will begin learning Geometry right before your eyes. Here is another great resource for
Python Turtle but you will need to use
Google Translate if you do not speak Spanish.
For really advanced/motivated students you could offer them
Project Euler which has many types of problems that if they can solve them would be well on their way to a successful job in mathematics or computer programming.
Blender is not for the faint of heart, and I will eventually devote a whole post to it, but your students could create their own Python scripts to make their 3D cars move, or create a
domino effect.
Games:
Don't count these out. They teach a ton of programming concepts and keep your students' interest high. One of the best and easiest resources I have seen is
Invent with Python which is a free resource that walks you through making fun games like Hangman, Tic Tac Toe and more.
You never know where inspiration will come. My suggestion to you is to go through tutorials or resources until you become comfortable enough with the language that you can create a demonstration in a few minutes in the classroom. However, you use computer science in the classroom, your students will benefit from it so I encourage you to take that first step a go for it! Good luck.
If you would like code for any of the programs I have mentioned, would like help writing your own, need additional resources, or anything else; please leave a comment or email me.