expressions + - * / basic arithmetic ** exponentiation % remainder VALUE % 2 tells you whether a number is odd VALUE % 10 chops a digit off of a number math commands abs(VALUE) absolute value ceil(VALUE) rounds up cos(VALUE) cosine, in radians floor(VALUE) rounds down log(VALUE) logarithm, base e log10(VALUE) logarithm, base 10 max(VALUE1, VALUE2) larger of two values min(VALUE1, VALUE2) smaller of two values round(VALUE) nearest whole number sin(VALUE) sine, in radians sqrt(VALUE) square root variables VARIABLE = VALUE VARIABLE = input("message") read a value from the keyboard print "message" print EXPRESSION print EXPRESSION1, EXPRESSION2, ..., EXPRESSIONn selection and repetition for VARIABLE in range(MIN, MAX): statements if CONDITION: statements elif CONDITION: statements else: statements while CONDITION: statements < > <= >= == != operators for comparing numbers/values && || ! operators for combining logical values strings and text processing "this is a string" reading a string as input VAR = raw_input("message") for letter in STRING: do something gluing strings together "hello" + "there" --> "hellothere" "hello" * 3 --> "hellohellohello" grabbing the pieces of a string s = "hi there" s[0] --> "h" s[1] --> "i" s[2] --> " " ... s[7] --> "e" s[0:3] --> "hel" s[2:5] --> " th" s[3:] --> "there" s[:2] --> "hi" testing properties of a string or character len(VAR) --> number of characters in the string. str.isalpha(VAR) --> True if the string is a letter, False if not. str.lower(VAR) --> a lowercase version of the string. str.upper(VAR) --> an uppercase version of the string. converting between numbers and strings ord("a") --> 97 chr(97) --> "a" reading a file VARIABLENAME = open("FILENAME").read() or for line in open("FILENAME").readlines(): statements drawing with the drawingpanel: from drawingpanel import * panel = drawingpanel(WIDTH, HEIGHT) g = panel.get_graphics() g.create_line(x1, y1, x2, y2, fill="color") g.create_oval(x1, y1, x2, y2, fill="color", outline="color") g.create_rectangle(x1, y1, x2, y2, fill="color", outline="color") panel.mainloop()