---
# System prepended metadata

title: '1'

---

# 1

ログイン中の、
サブスクライブ中の、
アカウントをBANされてないユーザーの一覧

```python
login_ids = [5, 6, 7, 8, 9]  # ログインユーザー
paid_ids = [2, 5, 8, 9]  # サブスクライブ中のユーザー
block_ids = [1, 3, 5, 6]  # アカウントをBANされたユーザー
```

```python

valid = []
for i in login_ids:

    for j in paid_ids:
        subscribed = False
        if i == j:
            subscribed = True
            break
    if not subscribed:
        break
    for k in block_ids:
        blocked = False
        if i == k:
            blocked = True
            break
    if blocked:
        break
    valid.append(i)
    
print(valid)
        
```

# 2

xからyを作る。

```
x = [
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
]
y = [
    [1, 3],
    [4, 6],
    [7, 9]
]
```

x = np.array(x)

x_heads = x[:, 0]
x_tails = x[:, -1]

y = np.concatenate((x_heads, x_tails), axis = 1)
# y = np.c_[x_head, x_tail]


y = []
for i in x:
    y_row = [i[0], i[2]]
    y.append(y_row)
    
print(y)