Python cheat sheet: Loop to print 100 numbers: for i in range(1,101): print i Loop to print a list LIS: for x in LIS: print x Example illustrating while, if, function definition: def collatz(n): count = 0 while n != 1: count = count + 1 if n % 2 == 0: n = n/2 else: n = 3*n+1 return count Basic cgi stuff: form = cgi.FieldStorage() n1 = form.getfirst("num1") # get string contents of form field # with NAME="num1" n1 = form.getfirst("num1", "100") # 100 is the "default" value, optional num1 = int(n1) # convert a string to an int b1 = form.getlist("button") # get a list of form items with the same name HTML cheat sheet ... ... Headings:

,

,...

bold,italic paragraph

horizontal rule:


"bulleted" list:
  • first
  • second
  • third
Table: # one row # more rows can be repeated as needed
col1 col2 col3
Frames: Now define as many frames as columns (or rows) were defined above, with: Frames can be new frameset subdivisions instead Forms
# text box # checkbox # radio button; # submit button