# Drag blocks to build your program…
No files yet. Use File blocks to write files, then run your program.
Quick Reference (PLS v5)
Full Edexcel 1CP2 Programming Language Subset. Use toolbox categories on the left.
Subprograms
| Type | Python |
|---|
| Procedure | def myProc(a,b): |
| Function | def myFunc(a): return x |
| Call proc | myProc(a, b) |
| Call func | x = myFunc(a) |
File Handling
| Op | Python |
|---|
| Open | f = open("f.csv","r/w/a") |
| Read lines | f.readlines() |
| Write | f.write("text") |
| Close | f.close() |
Lists
| Op | Python |
|---|
| Create | myList = [] |
| Append | myList.append(x) |
| Insert | myList.insert(i,x) |
| Delete | del myList[i] |
Libraries
| Module | Functions |
|---|
| random | randint(a,b) random() |
| math | ceil floor sqrt pi |
| time | sleep(sec) |
Turtle Graphics
| Command | Python |
|---|
| Create | t = turtle.Turtle() |
| Move | t.forward(d) t.back(d) |
| Turn | t.left(a) t.right(a) |
| Pen | t.penup() t.pendown() |
| Colour | t.pencolor("red") |
| Fill | t.begin_fill() t.end_fill() |
| Circle | t.circle(r) |
| Speed | t.speed(0-10) |
Format
{:<>^width.precf/d/s}