Week 1: Introduction Guide to Python

Create a Trinket account

  • trinket.io/python
  • Teachers may already have Google accounts set up for their students, in which case
    students can easily login to Trinket using their google account (Log in → Sign in with
    Google). Students can now save their projects and access them by logging in.
  • Students can create projects using the visual drag-and-drop Python interface
    (user_name → New Trinket → Blocks). If students have prior coding experience, they
    may wish to code directly in the Python programming language (user_name → New
    Trinket → Python).

Discussion

  • What is coding? What have you done with coding?
  • Code is everywhere – computers, phones, shopping, social media, cars, video games,
    watches, robots. Coding is about making things, and sharing what you make with the
    world.
  • Python: Web applications (Twitter, Instagram), video games, space missions, science
    labs (data analysis), music & video (Netflix, Youtube)

Topics

  • Introduce the interface/layout of Python on Trinket
    • On the left, the block palette contains all code blocks (commands) organized into groups. Blocks can be dragged into the scripts area to create a program.
    • In the middle, the scripts area is where we place our program’s code.
    • On the right, we click play to run our program.
  • X/Y axes & coordinates
    • We change our x and y position to move the turtle to various positions on the screen. Students may find the graphic below useful in reminding them when to use positive and negative x/y values
  • Pen up, pen down
    • Just like lifting your pen off the paper – you won’t leave a trace.
    • Pen up when you want your turtle to move without drawing. Pen down when you are ready to start drawing again.
  • Begin fill, endfill
    • To fill a shape, enclose it within a begin fill and an end fill. Otherwise, simply the outline of shapes are drawn.
  • Shapes
    • Created according a radius size
    • i.e. circle(50) draws a circle with a radius of 50

Lesson
⦁ Free for all! Create shapes of assorted colours, fills, and locations.

Example Programs (see ‘Learn Python using Trinket.io by Gheorghe Comanici’, https://sites.google.com/site/pythonontrinket/)