Skip to content

Instantly share code, notes, and snippets.

# append()
A = []
for i in range(N):
A.append(i)
# A[i] = i, assignment
A = [None] * N
for i in range(N):
A[i] = i
# for i in range(len(A))
for i in range(len(A)):
A[i]
# for a in A
for a in A:
a
# faster
[[None] * N for _ in range(N)]
# slower
[[None for _ in range(N)] for _ in range(N)]
# NG
[[None] * N] * N
# [None] * N
[None] * N
# [None for _ in range(N)]
[None for _ in range(N)]
# for _ in range(N)
for _ in range(N):
pass
# for i in range(N)
for i in range(N):
i
# while i < N
i = 0
# sort, lambda
A.sort(key=lambda x: x[1])
# sort, itemgetter
from operator import itemgetter
A.sort(key=itemgetter(1))
# sorted, lambda
A = sorted(A, key=lambda x: x[1])
# sort()
A.sort()
# sorted()
A = sorted(A)
# input()
N = int(input())
A = [int(input()) for _ in range(N)]
# sys.stdin.readline()
import sys
input = sys.stdin.readline
N = int(input())
A = [int(input()) for _ in range(N)]
@xkumiyu
xkumiyu / commit_message_example.md
Last active December 31, 2019 04:42 — forked from mono0926/commit_message_example.md
[転載] gitにおけるコミットログ/メッセージ例文集100
@xkumiyu
xkumiyu / mnist_to_image.py
Last active May 12, 2023 23:14
Download and Convert MNIST binary files to image files
import argparse
import gzip
import pathlib
import struct
import numpy as np
import pandas as pd
import requests
from PIL import Image