📘

review - algo

に公開

いい回答だったので、再確認する

https://algo-method.com/tasks/34222uSu
https://algo-method.com/tasks/3417aT7j

新しいSyntax

https://algo-method.com/tasks/1226QUnC

一気にListを生成可能。
リスト内包表記 一発でリストを作る [変換結果 for 要素 in リスト]
["結果1" if 条件 else "結果2" for 要素 in リスト]

for row in color_value:
binary_row = ['#' if val <= 127 else '.' for val in row]
print("".join(binary_row))

-1って何だ?

https://algo-method.com/tasks/3490E92Y

a = [3, 1, 4, 1, 5, 9]
b = list()
while len(a) > 0:
b.append(a[-1])
a.pop()
print(b[1])

初期値を―1にすればいいだけ

https://algo-method.com/tasks/216/submissions/1715086

1...100でループの記法

https://algo-method.com/tasks/215/editorial

データを受け取る
N = int(input()) 
A = list(map(int, input().split())) 

線形探索
count = 0
for i in range(1,N):  
    if A[i-1] < A[i]: 
        count += 1

答えを出力する
print(count) 

Discussion