summaryrefslogtreecommitdiff
path: root/python/code-examples.py
blob: d8d0042777d7ff5095f24039bae04cccba9a8154 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# test
a = 1
b = 4

def addto(x, l) :
    l.append({
        "n" : x,
        "c": []
    })
    for it in l :
        if it["n"] == 4 :
            subl = it["c"]
            subl.append(x)
            it['c'] = subl


malist = []

malist.append({ "n" : a })
print(malist)

addto(b, malist)
addto(b, malist)
print(malist)