In Introductory Python, students are learning code and making art.

Introductory Python is a course for students with minimal to no previous coding experience.  So, in keeping with tradition, we began the class by writing a "Hello, world!" program, which consists of one line of code in Python:    

print("Hello, world!")    

Much of my previous teaching experience has been in C++ and Java, and I am growing increasingly appreciative of how much easier it is to write such programs in Python!  

Then students learned how to accept input from the user in Python, which is equally straightforward:         

name = input("What is your name?")
print("Hello, " + name)

To practice these ideas, students either wrote a "Madlib", or a unit conversion program.  I try to make the programming exercises in this class as open-ended as possible, to cater to students with a wide range of previous coding experience.  One of my students wrote a Madlib with 22 different requests for input from the user, and another student wrote a conversion program with 12 different options (one of which was "miles to inches").



Moving on to loops and conditional statements, the main project for the unit was to write some sort of gambling game, which could be played over multiple rounds, and which used some sort of random process to decide whether the player wins or loses in each round.   Among the games written were roulette, a slot machine simulation, and a program which plays "Rock, Paper, Scissors" against the computer.  


Shilpa.jpg


Right now we are wrapping up a unit on Python turtle graphics.  The main project for the unit was to create a "Moire pattern", which consists of many copies of the same geometric shape, drawn inside a loop, and with one or more properties of the shape changing each time it is drawn.  For example, you could draw a sequence of circles of increasing diameter, or a sequence of congruent squares, each one rotated a bit from the previous one's location.

-- Steve Gregg