User:Inge Hoonte/oct20 2011: Difference between revisions

From XPUB & Lens-Based wiki
(Created page with "Link: [http://pzwart3.wdka.hro.nl/wiki/Prototyping/Soldier_Soldier_Will_You_Marry_Me Oct 20 class] Formal computer language -> mathematical or computing, not spoken, expressing...")
 
No edit summary
Line 32: Line 32:
  In [16]: x
  In [16]: x
  Out[16]: 'inge\nand\nmore\nstuff\nand more\nstuff'
  Out[16]: 'inge\nand\nmore\nstuff\nand more\nstuff'
===============
lunch
================
XML, SVG
* make sure you always open and close the code: header, closer
* .format after """ looks for previous {} and whatever is in there:
for x in range(100):
    print """
<rect
      style="fill:#ff00ff"
      id="rect2985"
      width="{0}"
      height="242.85715"
      x="{1} {2}"
      y="252.36218" />
""".format(x, y, z)

Revision as of 15:16, 20 October 2011

Link: Oct 20 class

Formal computer language -> mathematical or computing, not spoken, expressing ideas that can be processed

Procedural / Imperative -> tell the computer what to do, compare to following a recipe

  • bash
  • Python
  • PHP, Java, javascript, Rudy....

Declarative -> more descriptive, domain specific, compare to improv cooking

  • SVG
  • CSS, HTML
  • Lisp, Prolog
  • XPath

ipython: text is always the exception. put quotes around it. name = "inge" -> expression gets stored in a variable

name ="..." print "Hello", name, "etc"

str = string = textual object int = integer float = not whole number, eg 1.56

x = """inge
  ....: and
  ....: more
  ....: stuff
  ....: and more
  ....: stuff"""
In [16]: x
Out[16]: 'inge\nand\nmore\nstuff\nand more\nstuff'


===

lunch

====

XML, SVG

  • make sure you always open and close the code: header, closer
  • .format after """ looks for previous {} and whatever is in there:
for x in range(100):
   print """
<rect
      style="fill:#ff00ff"
      id="rect2985"
      width="{0}"
      height="242.85715"
      x="{1} {2}"
      y="252.36218" />
""".format(x, y, z)