Lecture 5 (Sherriff) - Turtle Power!

Lecture Date: Friday, September 2

Today, we are going to move a bit quick, but mainly so you can see a quick overview of a lot of concepts.

First, you need to get everything setup to go!

  1. Open PyCharm and either make a new project or open an existing one.
  2. Make a new Python file called turtle_drawing.py.
  3. Start by making a new turtle!

Here's some starter code:

import turtle

tom = turtle.Turtle()



Let's start making this a bit more complex. We'll work up to some of the code below.

# Mark Sherriff (mss2x)

import turtle
import random

def draw_square(t, x, y):
    rand_color = random.randint(0,len(colors)-1)
    for i in range(4):

tom = turtle.Turtle()

colors = ["green", "red", "yellow", "orange", "pink", "cyan"]

for i in range(10):
    rand_x = random.randint(-100,100)
    rand_y = random.randint(-100,100)

# draw_square(tom)


Another example:

import turtle
def drawShape(t, sides, size):
    angle = 360.0 / sides
    for i in range(sides):
        if t.color()[0] == "red":
dana = turtle.Turtle()
drawShape(dana, 6, 100)
drawShape(dana, 5, 100)

Final code we actually completed today:

import turtle
import random

yurtle = turtle.Turtle()
colors = ["green", "red", "yellow", "cyan", "orange", "pink"]

def draw_square(my_turtle, x, y):
   for i in range(4):
       rand_color = random.randint(0,len(colors)-1)

# Add code to draw 20 squares on the screen at random locations
for i in range(2000):
   rand_x = random.randint(-300,300)
   rand_y = random.randint(-300,300)
   draw_square(yurtle, rand_x,rand_y)


more ...

Lecture 4 (Sherriff) - Intro to PyCharm

Lecture Date: Wednesday, August 31

We might not cover all of this today - but we definitely will over the next week. I'm keeping all the info together to make it easier to find.

What is PyCharm?

  • PyCharm is to coding as Word is to writing a paper
  • PyCharm is an integrated development environment (IDE) - that means it has lots of tools in it to make coding easier
  • PyCharm is built to actually do some prediction as to what you're about to type

Starting up PyCharm

  • PyCharm works in projects
  • Think about each project being a different major thing
  • For example, you might have one project for in-class activities, one for POTDs, etc., but in the end it's up to you
  • When you create a new project, you may have a choice between Pure Python and Educational
  • Pure Python is where you go to start a blank project for your coding assignments and in-class work
  • Educational is where you go to do some of the built-in tutorials (if you got the Educational edition)
  • When you create a new Pure Python project, make sure to put it somewhere you can find easily outside of PyCharm so you can copy the files out to submit for POTDs, etc.

Inside PyCharm

A few main windows to note here:

  • Project view (left vertical) - this shows you all your projects and files
  • Editor (big middle pane) - this is the blank thing in the middle
  • Console (appears at bottom when you run code) - the output from your programs appear here

Your First Program

  • When you start a new program, start by making a new python file: File -> New -> Python File
  • Give the file a name with all lowercase letters
  • The file should be automatically opened in the editor with an author tag - you should change it to your computing ID

Hello World


"While small test programs existed since the development of programmable computers, the tradition of using the phrase "Hello world!" as a test message was influenced by an example program in the seminal book The C Programming Language. The example program from that book prints "hello, world" (without capital letters or exclamation mark), and was inherited from a 1974 Bell Laboratories internal memorandum by Brian Kernighan, Programming in C: A Tutorial, which contains the first known version." Hello World is often the first program written for any language or any new platform.

The Parts of a Program

(this can mainly be found in your text)

# Mark Sherriff (mss2x)

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

To run the code, right-click in the editor and choose Run.

We're not doing any fancy graphics yet, so the program runs in what is called the "console window." Think of this just like a command prompt or a DOS prompt (if that means anything to you). Before Windows was created (or any other graphical user interface (GUI)) programs ran as plain text. And that's how we're starting out in this class. It's simpler for now, trust me. I know it doesn't look as cool, but we'll do some graphics stuff later in the semester.

If we have time...

  • Looking at a project
  • Importing and Exporting projects
  • Taking this Hello World to the next level
  • More things to do in PyCharm!

more ...

Lecture 3 (Sherriff) - Ambiguity

Lecture Date: Monday, August 29

We will also talk about just how bad the English language is at being specific about things. (What things, you may ask? Well, isn't that part of the problem? :-) )

A little craft project will hopefully illustrate why we have programming languages and why they are written the way they are.

more ...

Lecture 2 (Sherriff) - The Case for CS

Lecture Date: Friday, August 26

There’s a large section of the syllabus we skipped over on the first day. The whole part about “what the class is about” and “why you are here.”

We’ll take time today to answer those questions. Why take CS1? What are the benefits? What exactly is in a CS1 course? What is CS? Should you be scared of taking a CS course if you have never programmed?

All of this and more!

(Spoiler - The answer to that last question is a resounding “NO!”)

Slides - PDF

more ...

Lecture 1 (Sherriff) - Welcome and Intro

Lecture Date: Wednesday, August 24

Welcome to CS 1110!

Today is our traditional first day of class. We'll go through the syllabus, discuss what our expectations are for the semester, talk about lab on Thursday (yes, you have lab on Thursday), and what it means to be in a CS course.

Come with your questions!

We're in for a fun ride! Look forward to seeing you there!

Specific topics:

  • The waitlist
  • Lab this week
  • POTDs
  • Computer / software
  • Lab access
  • Course website / Piazza
  • Course staff

more ...


Welcome to CS 1110 and CS 1111! We're excited to start the fall semester and hope you are too! We'll be posting more info here as we get everything together for the course so stay tuned!

Profs. Sherriff, Ibrahim, and Praphamontripong

more ...