@SnoopJeDi/

BusyHonoredComputationallinguistics

Python

No description

fork
loading
Files
  • main.py

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.1327560483758321","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"ZGVmIG1lcmdlKG9sZCwgbmV3KToKICAiIiIKICBSZXR1cm4gYSBuZXcgbGlzdCB3aXRoIGFsbCBlbnRyaWVzIGluIGBvbGRgIGFuZCBub3ZlbCBlbnRyaWVzIGluIGBuZXdgLiBEdXBsaWNhdGVzIGluIGBuZXdgIChidXQgbm90IGBvbGRgISkgYXJlIGlnbm9yZWQuCiAgIiIiCiAgcmV0ID0gb2xkLmNvcHkoKSAjIGF2b2lkIG11dGF0aW5nCiAgZm9yIGl0ZW0gaW4gbmV3OgogICAgaWYgaXRlbSBub3QgaW4gcmV0OgogICAgICByZXQuYXBwZW5kKGl0ZW0pCiAgCiAgcmV0dXJuIHJldAoKbDEgPSBbMSwyLDMsNCw1XQpsMiA9IFsxLDIsMyw0LDUsNiw2LDYsNyw4LC0xLC0xXQoKcHJpbnQoZidsMT17bDF9JykKcHJpbnQoZidsMj17bDJ9JykKcHJpbnQoJ21lcmdpbmcnKQpsMyA9IG1lcmdlKGwxLCBsMikKcHJpbnQoZidsMT17bDF9JykKcHJpbnQoZidsMj17bDJ9JykKcHJpbnQoZidsMz17bDN9Jyk="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
def merge(old, new):
  """
  Return a new list with all entries in `old` and novel entries in `new`. Duplicates in `new` (but not `old`!) are ignored.
  """
  ret = old.copy() # avoid mutating
  for item in new:
    if item not in ret:
      ret.append(item)
  
  return ret

l1 = [1,2,3,4,5]
l2 = [1,2,3,4,5,6,6,6,7,8,-1,-1]

print(f'l1={l1}')
print(f'l2={l2}')
print('merging')
l3 = merge(l1, l2)
print(f'l1={l1}')
print(f'l2={l2}')
print(f'l3={l3}')