<filename>test.py
import copy
from functools import reduce

a = [[1], [2], [3], [4], [5]]
for i in a:
    i.append(0)
print(a)

a = [{"1": 1}, {"1": 2}, {"1": 3}, {"1": 4}, {"1": 5}]
for i in a:
    i['1'] += 1
print(a)

a = [1, 2, 3, 4, 5]
for i in a:
    i += 1
print(a)

a = [[1], [2], [3], [4], [5]]
for i in a:
    i[0] = i[0] + 1 if i[0] > 1 else i[0]
print(a)

b = {1: [1, 2, 3]}
# print(type(b.get(1)))
a = b.get(1)
a.append(4)
print(b)

if b.get(1):
    print(b)

print([1] + [2])


def a(b=1):
    print(b)


a(2)

a, b, c, *r, d = range(1, 10)
print("r=",str(r))

if not None:
    print("Not None")
else:
    print("None")

a = [1, 2, [1, 2], 3]
b = a
c = copy.copy(a)
d = copy.deepcopy(a)
a[2].append(3)
a.append(4)
a[0] = 0
print(a)
print(b)
print(c)
print(d)

a = 'spade'
b = a
print(id(a))
print(id(b))
b = 'ss'
print(a)
print(id(a))
print(id(b))

a = [1, "222"]
b = a
print(id(a))
print(id(b))
# b = [2,"111"]
b.append(1)
print(a)
print(id(a))
print(id(b))

a = [True, True]
b = [True, False]
c = [False, False]
if a:
    print(True)
if b:
    print(False | True)
if c:
    print(False)


def test():
    for i in range(0, 5):
        yield i
    return 5


for i in test():
    print(i, end=' ')
print()

rules = [1, 2, 4, '5']
if rules:
    for rule in rules:
        if isinstance(rule, int):
            print(rule)

print([x for x in rules if isinstance(x, int)] if rules else [])

data_list = [{
    "a": "123",
    "b": "321"
}, {
    "a": "123",
    "b": "321"
}, {
    "b": "321",
    "a": "123"
}]


def run_function(x, y):
    return x if y in x else x + [y]


a = [
    1, 2, 3, 4, 1, 2, '1', '2', '2', {
        "a": "123",
        "b": "321",
        "c": "!"
    }, {
        "a": "123",
        "b": "321"
    }, {
        "b": "321",
        "a": "123"
    }
]
data_list = reduce(run_function, [
    [],
] + a)
print(data_list)

a = [
    1, 2, 3, 4, 5, {
        "a": "123",
        "b": "321"
    }, {
        "a": "123",
        "b": "321"
    }, {
        "b": "321",
        "a": "123"
    }
]
a = reduce(lambda x, y: x if y in x else x + [y], [[]] + a)
print(a)


class Father(object):
    def __init__(self):
        self.a = 1
        self.b = 2
        self.c = 3

    def getA(self):
        return self.a

    def getB(self):
        return self.b

    def __printB(self):
        print(self.b)


class Son(Father):
    def __init__(self):
        super().__init__()
        self.a = 4

    def getC(self):
        return self.c


s = Son()
print(s.getC())



a = [10,10,10,10,11]
b = [lambda :x for x in a]
print(b[0]())
b = map(lambda r:r+10, a)
for i in b:
    print(i,end=' ')
print()
b = filter(lambda r:r>10, a)
for i in b:
    print(i,end=' ')
<filename>test.py
import copy
from functools import reduce

a = [[1], [2], [3], [4], [5]]
for i in a:
    i.append(0)
print(a)

a = [{"1": 1}, {"1": 2}, {"1": 3}, {"1": 4}, {"1": 5}]
for i in a:
    i['1'] += 1
print(a)

a = [1, 2, 3, 4, 5]
for i in a:
    i += 1
print(a)

a = [[1], [2], [3], [4], [5]]
for i in a:
    i[0] = i[0] + 1 if i[0] > 1 else i[0]
print(a)

b = {1: [1, 2, 3]}
# print(type(b.get(1)))
a = b.get(1)
a.append(4)
print(b)

if b.get(1):
    print(b)

print([1] + [2])


def a(b=1):
    print(b)


a(2)

a, b, c, *r, d = range(1, 10)
print("r=",str(r))

if not None:
    print("Not None")
else:
    print("None")

a = [1, 2, [1, 2], 3]
b = a
c = copy.copy(a)
d = copy.deepcopy(a)
a[2].append(3)
a.append(4)
a[0] = 0
print(a)
print(b)
print(c)
print(d)

a = 'spade'
b = a
print(id(a))
print(id(b))
b = 'ss'
print(a)
print(id(a))
print(id(b))

a = [1, "222"]
b = a
print(id(a))
print(id(b))
# b = [2,"111"]
b.append(1)
print(a)
print(id(a))
print(id(b))

a = [True, True]
b = [True, False]
c = [False, False]
if a:
    print(True)
if b:
    print(False | True)
if c:
    print(False)


def test():
    for i in range(0, 5):
        yield i
    return 5


for i in test():
    print(i, end=' ')
print()

rules = [1, 2, 4, '5']
if rules:
    for rule in rules:
        if isinstance(rule, int):
            print(rule)

print([x for x in rules if isinstance(x, int)] if rules else [])

data_list = [{
    "a": "123",
    "b": "321"
}, {
    "a": "123",
    "b": "321"
}, {
    "b": "321",
    "a": "123"
}]


def run_function(x, y):
    return x if y in x else x + [y]


a = [
    1, 2, 3, 4, 1, 2, '1', '2', '2', {
        "a": "123",
        "b": "321",
        "c": "!"
    }, {
        "a": "123",
        "b": "321"
    }, {
        "b": "321",
        "a": "123"
    }
]
data_list = reduce(run_function, [
    [],
] + a)
print(data_list)

a = [
    1, 2, 3, 4, 5, {
        "a": "123",
        "b": "321"
    }, {
        "a": "123",
        "b": "321"
    }, {
        "b": "321",
        "a": "123"
    }
]
a = reduce(lambda x, y: x if y in x else x + [y], [[]] + a)
print(a)


class Father(object):
    def __init__(self):
        self.a = 1
        self.b = 2
        self.c = 3

    def getA(self):
        return self.a

    def getB(self):
        return self.b

    def __printB(self):
        print(self.b)


class Son(Father):
    def __init__(self):
        super().__init__()
        self.a = 4

    def getC(self):
        return self.c


s = Son()
print(s.getC())



a = [10,10,10,10,11]
b = [lambda :x for x in a]
print(b[0]())
b = map(lambda r:r+10, a)
for i in b:
    print(i,end=' ')
print()
b = filter(lambda r:r>10, a)
for i in b:
    print(i,end=' ')
# print(type(b.get(1))) # b = [2,"111"]