from IPython import display
Sym+Remember: - - - | Sym+Forget: - - - | Sub-Sym+Remember: ---- | Sub-Sym+Forget: ---- |
for i in [1, 2, 3, 4]:
print "The count is", i
print "Done counting"
Choice Points = Source of Generativity
(all-values
(let
((size
(either 'small 'medium 'large))
(sport
(either 'baseball 'golf 'basketball)))
(list size sport)))
(all-values
(let
((size
(either 'small 'medium 'large))
(sport
(either 'baseball 'golf 'basketball)))
(assert! (and
(<-> 'small 'golf)
(<-> 'medium 'baseball)
(<-> 'large 'basketball)))
(list size sport)))
Solution | Size | Sport |
---|---|---|
1 | Small | Baseball |
2 | Small | Golf |
3 | Small | Basketball |
4 | Medium | Baseball |
5 | Medium | Golf |
6 | Medium | Basketball |
7 | Large | Baseball |
8 | Large | Golf |
9 | Large | Basketball |
Cheryl has a birthday, and she doesn't want to share it right away. So she gives her friends Albert and Bernard a list of 10 possible birthday dates:
Cheryl then tells Albert and Bernard separately the month and the day of her birthday respectively.
GENERIC-PROGRAM-TYPE:
LG1. GENERIC-LINE-GROUP-TYPE:
L1. ASSIGNMENT-LINE-TYPE | (indent:1):
EXPR-LITERAL : PYTYPE-NUMBER
[NAME] a
[SYMBOL] =
[NUMBER] 1
L2. ASSIGNMENT-LINE-TYPE | (indent:1):
EXPR-LITERAL : PYTYPE-NUMBER
[NAME] b
[SYMBOL] =
[NUMBER] 2
L3. PRINT-LINE-TYPE | (indent:1):
EXPR-VV-PLUS : PYTYPE-NUMBER
[KEYWORD] print
[NAME] a
[SYMBOL] +
[NAME] b
for i in [1, 2, 3, 4]:
print "The count is", i
print "Done counting"
a = 4
b = 3
print a + b
c = 7
d = 2
print c + d
e = "5"
f = "3"
print e + f
"...the smallest piece of knowledge used in program understanding is a transaction. A transaction can be described using three categories: what operation takes place (action), where it takes place (location) and what object is acted upon (object)."
def add_1(num):
num = num + 1
def twice(num):
num = num * 2
added = 4
add_1(added)
twice(added)
add_1(added)
twice(added)
print added